How to create key value dictionary in Perl

2 Answers

0 votes
use strict;
use warnings;

my %dict = ("Perl" => ".pl", "Start" => 1987, "Implementation" => "c");

print %dict



## run:
##
## Perl.plImplementationcStart1987
## 

 



answered Dec 15, 2022 by avibootz
0 votes
use strict;
use warnings;

my %dict = ("Perl" => ".pl", "Start" => 1987, "Implementation" => "c");

printf "%s %s\n", $_, $dict{$_} for sort keys %dict;



## run:
##
## Implementation c
## Perl    .pl
## Start   1987
## 

 



answered Dec 15, 2022 by avibootz
edited Dec 15, 2022 by avibootz

Related questions

2 answers 115 views
3 answers 204 views
204 views asked May 20, 2025 by avibootz
1 answer 137 views
137 views asked May 19, 2025 by avibootz
1 answer 148 views
...