Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Re: Finding number of lines in STDIN

by CombatSquirrel (Hermit)
on Dec 18, 2003 at 10:33 UTC ( [id://315486]=note: print w/replies, xml ) Need Help??


in reply to Re: Finding number of lines in STDIN
in thread Finding number of lines in STDIN

More specifically probably something like this (untested):
my $max = 10; my $num = 0; my @lines; while (<STDIN>) { last if ++$num > $max; push @lines, $_; }

Hope this helped.
CombatSquirrel.
Entropy is the tendency of everything going to hell.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-03-28 23:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found