trala has asked for the wisdom of the Perl Monks concerning the following question:
Well, it doesn't work. I get the error "Can't open 1: no such file or directory" and the parsed output is as if no data has been processed. I assume this is because the 1 is going into <> along with the piped input. Is there some way I can get it out of there before going into my while loop? Also, a curiosity is that the following code behaves slightly differently:$num = @ARGV[0]; while (<>) { (parser algorithm) } print ("$result");
I still get the error message, but now the parser output is correct. I could just redirect stderr to null and my output is perfect ;) but I'd like to know the "right" way to do this.$num = @ARGV[0]; printf (<>); while (<>) { (parser algorithm) } print( "$result" )
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: parameters and piped input
by Bob9000 (Scribe) on Aug 10, 2005 at 17:21 UTC | |
|
Re: parameters and piped input
by ikegami (Patriarch) on Aug 10, 2005 at 17:57 UTC | |
|
Re: parameters and piped input
by sk (Curate) on Aug 10, 2005 at 20:14 UTC |