my @list = qw(a b c d e f g h); my %hash = reverse @list; print map { "$_ -> $hash{$_}\n" } keys %list; #Prints: h -> g b -> a d -> c f -> e