Scot Robnett wrote:
Does anyone know how I capture the value of an operation that defaults to
STDOUT? For instance if I want to do something like

#!/usr/bin/perl -w

use strict;
my $value = `perl -c someapp.cgi`; # prints to STDOUT
print "Content-type: text/html\n\n";
print "Result: $value<BR>";


This obviously won't work because 'perl -c' directs the output away from my variable and into STDOUT. I'm thinking I might be able to capture that return value using IO::Handle or something of that nature but I'm not sure how. Can anyone help?


Sure you have a standard error. ;-)


perl -c 's output goes to STDERR not STDOUT. For this you will want to look at any of IPC::Open2, IPC::Open3, or simply adding a construct like:

2>&1

to the backtick command. HTH,

http://danconia.org


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to