- or download this
use strict;
use warnings;
...
print "In the function, the key is $key and the value is $val\n";
$hashref->{$key} = $val;
}
- or download this
$ perl populate_hash.pl
The array is: sean connery george lazemby roger moore timothy dalton p
+ierce brosnan
...
'pierce' => 'brosnan',
'george' => 'lazemby'
};
- or download this
use strict;
use warnings;
...
$myHash{$key} = $val;
}
print Dumper \%myHash;
- or download this
$ perl populate_hash.pl
$VAR1 = {
...
'pierce' => 'brosnan',
'george' => 'lazemby'
};