And to see exactly what your hash does contain, use Data::Dumper (or one of its descendants). (I'm passing Dumper a reference to the hash because it prints it in a more hash-like manner that way.)
abaugher@Aliantha ~$ cat doit #!/usr/bin/perl use Modern::Perl; my @array = ( 'key', 'value' ); my %hash = @array; say "The value of 'key' is '$hash{key}'"; use Data::Dumper; print Dumper \%hash; abaugher@Aliantha ~$ perl doit The value of 'key' is 'value' $VAR1 = { 'key' => 'value' };
Aaron B.
My Woefully Neglected Blog, where I occasionally mention Perl.
In reply to Re^4: How to create hash out of an array elements?
by aaron_baugher
in thread How to create hash out of an array elements?
by jojojo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |