use warnings; use strict; my %hash = ( 1 => 'one' , 2 => 'two' , 3 => 'three' ); # Here is the one line! my( @one ) = @hash{ my( @two ) = keys %hash }; # This line is just to demonstrate it worked. print map { "$two[$_] => $one[$_]\n" } 0 .. $#two;