in reply to Reading zipped files (.gz)

Your filenames end with newlines. You likely do not want that.

Also, the following code makes no sense:

open my $fh, q{<}, qq{tar xzOF $file | } or die $!;

Either use the two-argument version of open, with an appended pipe, or use the three argument version, with -|. Mixing two-argument and three-argument syntax makes no sense. Perl tries to open a file that has a name of "tar xzOF ...", and such a file presumably does not exist.

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

    atcroft Suggested that line in CB. I want to read the gz files line by line. At first I tried that using system command. But its taking lot of CPU & memory. Before starting that unzipping the memory is 77.63%. I tested that on 100MB data. After unzipping its showing 78.52%. Even the process exists the memory is not becoming free. So, I decided to read the unzip file directly using perl modules.

      What does your reply have to do with my remarks?

      I pointed out where problems in your program lie, which lead to you not being able to read the files. Have you addressed the immediate problems I pointed out?

      It is bad style to use `ls ...`. I prefer to use File::Glob::bsd_glob to expand wildcards. This also eliminates the need to remove whitespace at the end of filenames.

        I open you link downloaded perl-5.21.3.tar.gz.

        1)tar xvfz perl-5.21.3.tar.gz 2)cd perl-5.21.3

        After that I cant find that .PL file in that folder. This is the correct link you provided?? Or I missing it???