in reply to Cannot skip first lines in array

Assuming that @rebasefile is an array you can skip the first 10 indices in a couple of ways
foreach (@rebasefile[10..$#rebasefile]){ # skips the first ten automat +ically next if(/^\s*$/); ... }
# alternately if you don't want the overhead of creating an array slice
foreach (@rebasefile){
next for (0..9); # of course, this has overhead of its own
next if(/^\s*$/);
...
}
I haven't checked which implementation is faster. I suspect that for just 10 elements, there is a non-measurable difference. If you were ignoring 100 or more elements, the slice is probably more efficient.

Update:

Ignore the second loop. Never get smug before your first cup of coffee.

PJ
use strict; use warnings; use diagnostics;

Replies are listed 'Best First'.
Re^2: Cannot skip first lines in array
by dave_the_m (Monsignor) on Oct 20, 2004 at 12:53 UTC
    foreach (@rebasefile){ next for (0..9); # of course, this has overhead of its own next if(/^\s*$/); ... }
    That doesn't skip the first 10 elements, it just calls an empty loop 10 times for each element.

    Dave.

Re^2: Cannot skip first lines in array
by Taulmarill (Deacon) on Oct 20, 2004 at 15:24 UTC
    i don't think next for (0..9); is working the way you want.
    however, the first foreach loop should work just fine.