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

Hi

, I need a clarification for the below.

The main concept is that i want to skip the error file.

I am having two files. One file contains junk values, when i tried to open that, it will through "error" and another file is working fine.

If i used the below eval function for error file it's working fine. But when i tried for a working file (i.e. without junk file), iam not getting any values in the default variable. Kindly suggest me how to handle this.

open(IN, "gzip -dc file.gz| > /dev/null");
while(<IN>){
print $_;
}

Replies are listed 'Best First'.
Re: eval function
by zentara (Cardinal) on Jul 22, 2011 at 12:27 UTC
    This is untested, and I'm not a shell string guru, but maybe you are looking just to quiet the output of the command? Maybe try moving the /dev/null to the other side of the pipe
    #untested open(IN, "gzip -dc file.gz 2 > /dev/null | "); #or open(IN, "gzip -dc file.gz 2>&1 > /dev/null | ");

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
Re: eval function
by Anonymous Monk on Jul 22, 2011 at 11:21 UTC
    What do you think > /dev/null does? Try it yourself
    echo hello echo hello > /dev/null