tie @array, 'Tie::File', "filename" or die ...; my $i; for (@array) { if (m/some regex/) { last } $i++; } splice(@array, 0, $i);