system commands in perl 
Author Message
 system commands in perl

Is there a way to capture the output of a unix command when
you execute it from a perl script using the system("   ") command ????

Neil Frenette
Nortel



Fri, 22 Dec 2000 03:00:00 GMT  
 system commands in perl

Quote:

> Is there a way to capture the output of a unix command when
> you execute it from a perl script using the system("   ") command ????

Not that I would know of, but that's why the backticks are around, I suppose:

$arg = `ls`;
print $arg;

--
____________________________________________________________
Frank Quednau              
http://www.surrey.ac.uk/~me51fq
________________________________________________



Fri, 22 Dec 2000 03:00:00 GMT  
 system commands in perl


: Is there a way to capture the output of a unix command when
: you execute it from a perl script using the system("   ") command ????

Not directly, no.  If you want the output, use backticks `` instead.

---------------------------------------------------------------------

 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/  
       "Every man and every woman is a star."



Fri, 22 Dec 2000 03:00:00 GMT  
 system commands in perl



Quote:
>Is there a way to capture the output of a unix command when
>you execute it from a perl script using the system("   ") command ????

You might want to read the docs, especially perldoc -f open.

Greetings
Marc

--
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber          |   " Questions are the         | Mailadresse im Header
Karlsruhe, Germany  |     Beginning of Wisdom "     | Fon: *49 721 966 32 15
Nordisch by Nature  | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29



Fri, 22 Dec 2000 03:00:00 GMT  
 system commands in perl


Quote:
>Is there a way to capture the output of a unix command when
>you execute it from a perl script using the system("   ") command ????

No.  You need to use the qx{...} operator instead.

This is a FAQ.



Sat, 23 Dec 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. how to use unix system command in perl

2. System command in perl CGI

3. using system() command in perl/cgi script running under Linux

4. Problems with system command in perl

5. How to execute a system command from Perl (NT)

6. Kill Signals going to forked System command not Perl script

7. how to use unix system command in perl

8. system command in perl

9. System commands from perl on NT

10. system command by perl

11. using system commands in perl

12. Problems with system command in perl

 

 
Powered by phpBB® Forum Software