in reply to Re^2: Deleting specific array elements
in thread Deleting specific array elements

That's very inefficient, O(N^2) worst case under the hood. If your data is so big it doesn't fits in memory, it is not a good solution either. Note also, that the grep solution is swap-friendly as it access memory in a sequential manner.

Anyway, if you want to minimize memory usage and still be O(N):

my $to = 0; for (@m) { $m[$to++] = $_ if $_ ne "\n"; } splice @m, $to;