in reply to Re: Skip 21 Lines
in thread Skip 21 Lines

Something I always use for the xth line of a file....
(undef,undef,undef,undef,$line) = <FILE>;
At the expense of reading the entire file and tossing all but one of the lines. Ouch!

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re (tilly) 3: Skip 21 Lines
by tilly (Archbishop) on Apr 25, 2001 at 05:14 UTC
    Isn't it more maintainable to write that as:
    $line = (<FILE>)[4];
    ?
        Yes, that was a joke.

        But if you are going to be inefficient, at least be idiomatically inefficient. I didn't like having to count through undefs to figure out which line you were grabbing...

A reply falls below the community's threshold of quality. You may see it by logging in.