in reply to Simplifying for loop and applying multiple push function

As one line using the comma operator:

use strict; use warnings; my %hash = ( 1 => 'one' , 2 => 'two' , 3 => 'three' ); my (@one, @two); (push @one , $hash{$_}), push @two, $_ foreach ( keys %hash ); print "@one\n@two";

Prints:

one three two 1 3 2

DWIM is Perl's answer to Gödel