in reply to Get output after running IPC::Run
Re update 2,
chomp returns what it chomped, if anything. Since the string doesn't end with a newline (the content of $/), chomp returns an empty string or something equally false.
So adjust $/ if you want to chomp something other than newlines. But even then, it makes no sense to check what chomp returns. Use
or the sanerchomp($out), print "Output: $out\n" if $out;
if ($out) { chomp($out); print "Output: $out\n"; }
Actually, why is the chomp conditional?
chomp($out); print "Output: ", length($out) ? $out : "[nothing]", "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Get output after running IPC::Run
by pid (Monk) on Nov 24, 2009 at 07:07 UTC |