Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Re: Skip 21 Lines

by merlyn (Sage)
on Apr 24, 2001 at 19:38 UTC ( #75103=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://75103]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2022-01-22 18:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (63 votes). Check out past polls.

    Notices?