Chris Rodriguez wrote: > > > */Bill Luebkert <[EMAIL PROTECTED]>/* 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. "cmd" refers to any command, right? 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? >
first, this sounds realy bad if you have to reboot your computer after running such simple perl things. Maybe you should check your installation of perl and windows, and maybe your RAM too. Anyway, I use to write the output in a filehandle like this open IN, "change user /query 2>&1|" or warn "does not work\n"; change user /query is a command from a Windows Terminal Server. always worked for me. Alex Vorstand/Board of Management: Dr. Bernd Finkbeiner, Dr. Florian Geyer, Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech Vorsitzender des Aufsichtsrats/ Chairman of the Supervisory Board: Prof. Dr. Hanns Ruder Sitz/Registered Office: Tuebingen Registergericht/Registration Court: Stuttgart Registernummer/Commercial Register No. HRB 382196 _______________________________________________ Perl-Win32-Users mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
