Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

hai monks
the way i execute my code looks something like this
zcat file | head -5000 | tail -1000 | ./program.pl
when i do this the die statement in the program dosent work
or in other words the statement works but the program
dosent stop executing and it reads in all the 1000 lines
i wld like to know the reason
thanks in advance

Replies are listed 'Best First'.
Re: simple one
by dvergin (Monsignor) on Dec 13, 2002 at 05:58 UTC
    If you want us to help you understand why your program does what it does, you have to show us the code for the program -- or, if it is lengthly, a stripped-down version that illustrates your problem.

    Huh... The danged Troll Proximity Indicator is acting funny again.

      I would like to tell that
      the program works fine when i remove the
      tail statement
      so i guess the problem is bcos of that tail
      statement.
Re: simple one
by fruiture (Curate) on Dec 13, 2002 at 11:03 UTC

    You've already got the problem: tail takes the _end_ of a stream and that can only be determined when the stream ends. So tail will start its output to ./program.pl when the other programs have done their job.

    --
    http://fruiture.de