|We don't bite newbies here... much|
Perl won't run command with "|&"by italdesign (Novice)
|on Sep 19, 2013 at 22:19 UTC||Need Help??|
italdesign has asked for the
wisdom of the Perl Monks concerning the following question:
Hello again monks. Please tell me what I'm doing wrong. Here's a piece of code to illustrate what I'm trying to do:
Running the script, I get the following error:
Yet, if I copy and paste the EXACT command reported in the error msg (namely /usr/bin/wget "http://www.google.com" |& tee /path/to/tee.log) and run it on the command line, it works just fine.
I've tried several variations of this, including using system() and exec() instead of ``, as well as escaping | and &. Nothing works.
I am running csh if that makes any difference.
Ultimately what I'm trying to do is run wget and have the output (STDERR + STDOUT) sent to both 1) a log file, as well as 2) a variable in my program. I've looked at Capture::Tiny but it seems to only accomplish one or the other.