List Info

Thread: Re: Redirecting STDOUT




Re: Redirecting STDOUT
country flaguser name
United States
2007-03-30 16:04:56
Chris Rodriguez wrote:
> Hi everyone,
> I saw the following on another PERL list-serve:
> 
> "If you are on windows, then see perlfaq8 if
ActiveState perl for
> how to redirect STDOUT and STDERR when doing
backticks."
> 
> I'd like to be able to capture STDOUT as a string.  But
nothing on perlfaq8 struck me as relevant.  Did I miss
something?  How do I do this?  I frequently get drastic
errors (my computer shuts down!) when I try to use
backticks.

Did you read:

	How can I capture STDERR from an external command?

Also check out the perlop man page under:

     qx/STRING/
     `STRING`

     ...

     $output = `cmd`;
# or grab STDERR as well
     $output = `cmd 2>&1`;

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Userslistserv.ActiveState.com
To unsubscribe: http:/
/listserv.ActiveState.com/mailman/mysubs

Re: Redirecting STDOUT
country flaguser name
United States
2007-04-01 16:09:22


Bill Luebkert <dbecollroadrunner.com> wrote:
Chris Rodriguez wrote:
>; Hi everyone,
> I saw the following on another PERL list-serve:
>
> "If you are on windows, then see perlfaq8 if ActiveState perl for
> how to redirect STDOUT and STDERR when doing backticks."
>
> I'd like to be able to capture STDOUT as a string. But nothing on perlfaq8 struck me as relevant. Did I miss something? How do I do this? I frequently get drastic errors (my computer shuts down!) when I try to use backticks.

Did you read:

How can I capture STDERR from an external command?

Also check out the perlop man page under:

qx/STRING/
`STRING`

...

$output = `cmd`;
# or grab STDERR as well
$output = `cmd 2>&1`;

Hi.&nbsp; "cmd" refers to any command, right?&nbsp; Neither formulation works for me.  If I do:
$output = `perl -c somescript.pl`;
I see "somescript.pl syntax OK" on the screen, and the variable $output remains unassigned.  If I do:
$output = `perl -c somescript.pl 2>&1`;
I get a message saying "This program has performed an illegal operation..." and I have to turn off my computer.
I've had the same problem using qx too.  Could it be that I'm using PERL 5.6?

Chris

2;


Never miss an email again!
Yahoo! Toolbar
alerts you the instant new Mail arrives. Check it out.
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )