Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: printing specific lines

by esskar (Deacon)
on Feb 27, 2005 at 21:10 UTC ( #434926=note: print w/replies, xml ) Need Help??


in reply to printing specific lines

as i understand: store the line number in a hash instead, so
my %lines = map { ($_, 1) } qw/1 3 5 7/; open(IN, "<grep") or die; while (<IN>) { print OUT $_ if $lines{$.}; }
HTH

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2023-01-30 12:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?