my %hash; for(my $i; $i < @out; $i++) { # do something with $out[$i]; # do something with $out1[$i]; }