use strict; my %hash; my @array=qw(one 1 two 2 two 20); for (my $i=0;$i<@array;$i+=2){ push @{$hash{$array[$i]}}, $array[$i+1]; } for my $key( keys %hash){ print "$key => @{$hash{$key}}\n"; }