use warnings; use strict; my @arr = 'a' .. 'e'; my %hash; for my $i (0 .. $#arr) { $hash{$i} = $arr[$i]; } use Data::Dumper; $Data::Dumper::Sortkeys=1; print Dumper(\%hash); __END__ $VAR1 = { '0' => 'a', '1' => 'b', '2' => 'c', '3' => 'd', '4' => 'e' };
In reply to Re: converting an array to an hash
by toolic
in thread converting an array to an hash
by savio
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |