in reply to Cannot skip first lines in array

I don't think you saw exactly that code in any book. You should replace:

if (/1 .. 10/) {next;}
with
if (0 .. 9) {next;}
Of course that doesn't actually work either because it will only work in the context of a:
while(<FILEHANDLE>) { # ... }
type statement.

/J\

Replies are listed 'Best First'.
Re^2: Cannot skip first lines in array
by ihb (Deacon) on Oct 20, 2004 at 13:01 UTC

    The flip-flop really should start at 1 and be 1 .. 10 because after the first read, $. will be 1.

    Related documents:
    perlvar - Perl predefined variables
    perlop - Perl operators and precedence

    ihb

    See perltoc if you don't know which perldoc to read!
    Read argumentation in its context!

Re^2: Cannot skip first lines in array
by tinita (Parson) on Oct 21, 2004 at 12:28 UTC
    because it will only work in the context of a: while(<FILEHANDLE>)

    or, of course:

    { local $. = 0; for (@array) { if ( 0..9 ) {} .... } $.++; }
    =)
Re^2: Cannot skip first lines in array
by travisbickle34 (Beadle) on Oct 20, 2004 at 12:42 UTC
    Admittedly, the code was changed slightly from the book version but caused an identical error to what was shown in the book. I've just downloaded the online version of the book code however, and it is actually different from what was shown in the book. As you said, it uses a while loop as opposed to the foreach loop shown in the book.