in reply to Finding number of lines in STDIN

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

Replies are listed 'Best First'.
Re: Re: Finding number of lines in STDIN
by CombatSquirrel (Hermit) on Dec 18, 2003 at 10:33 UTC
    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.