sub f { @foo = ( 1, 2 ); @bar = ( 3, 4 ); return \@foo, \@bar; } foreach ( f() ) { print @{$_}; }