sub listToIndexedHashRef{ my $n=0; my %hash = map{ $n++, $_} @_; return \%hash };; my $hashRef = listToIndexedHash( qw[the quick brown fox ] );; pp $hashRef;; { "0" => "the", 1 => "quick", 2 => "brown", 3 => "fox" } sub listToIndexedList{ my $n=0; return map{ $n++, $_} @_; };; my %hash = listToIndexedList( qw[the quick brown fox ] );; pp \%hash;; { "0" => "the", 1 => "quick", 2 => "brown", 3 => "fox" }