in reply to Re^8: Reading zipped files (.gz)
in thread Reading zipped files (.gz)

Sorry, that's my error. The command to open must be:

my $cmd = sprintf 'gzip -cd "%s" |', $file;

I think now is a good time to (re)read and understand the documentation for open.

Replies are listed 'Best First'.
Re^10: Reading zipped files (.gz)
by ravi45722 (Pilgrim) on Nov 18, 2015 at 10:17 UTC

    Is this method is better or using a module is better??? If there is any change in execution time I dont have any objection. My main concern is memory.

      Using this method, your program will read line-by-line from what the gzip program outputs. Maybe you can measure the differences in RAM usage if you decompress data yourself and if you let gzip decompress data.

Re^10: Reading zipped files (.gz)
by ravi45722 (Pilgrim) on Nov 18, 2015 at 10:50 UTC

    It will read all my file into memory. But I think it's not best practice because am dealing with a bit large files. Is there any other way????

      No, you are wrong.

      The above will not read all your file into memory.

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