in reply to using zcat for input?

You would want to open it as piped input, such as the following:

open(IN, sprintf("zcat %s |", $filename)) or die("Can't open pipe from command 'zcat $filename' : $!\n"); while (<IN>) { # process lines } close(IN);

See also the documentation for the open() function (also available via 'perldoc -f open').

Hope that helped.

Update: (31 Oct 2004)

Added link to documentation for open(). Changed from using 'gzip -dc $filename |' to 'zcat $filename |'.

Replies are listed 'Best First'.
Re^2: using zcat for input?
by thor (Priest) on Nov 01, 2004 at 02:55 UTC
    Just curious...but why the sprintf on the open. Wouldn't open(IN, "zcat $filename |") or die "..." be sufficient?

    thor

    Feel the white light, the light within
    Be your own disciple, fan the sparks of will
    For all of us waiting, your kingdom will come

      at least not for me, since the scripts take a lot of time to finish.