my @front, @back; while( @array1 ) { if( exists $skip{$_->[0]} ) { push @back, $_; else { push @front, $_; } } my @array2 = (@front, @back); #### push @{exists $skip{$_->[0]} ? \@back : \@front}, $_;