#!usr/bin/perl -w use strict; my @names = ("Tom", "Mary", "Nat", "Luke"); my %people; for(my $i=0; $i < @names; $i++) { $people{$names[$i]}={}; $people{$names[$i]}{number}=$i; $people{$names[$i]}{numbx2}=$i*2; } foreach my $key (keys(%people)) { print "\n".$key."\t".$people{$key}{numbx2}."\t".$people{$key}{number}; } #### #!usr/bin/perl -w use strict; my @names = ("Tom", "Mary", "Nat", "Luke"); my %people; for(my $i=0; $i < @names; $i++) { $people{$names[$i]}={}; $people{$names[$i]}{number}=$i; $people{$names[$i]}{numbx2}=$i*2; } foreach my $key (keys(%people)) { foreach my $pkey (keys($people{$key})) { print "\n".$key."\t".$people{$key}{$pkey}; } }