running shell command in Perl script
Does not work.
Code:
#!/usr/bin/perl Code:
#!/usr/bin/perl how do i run commands directly without using system or exec ? perl version is 5.8.8 built for i386-linux-thread-multi |
You can open a pipe:
Code:
open( PIPE, "ls -l /etc|" ) or die "Couldn't read pipe: $!"; |
How about this:
Code:
#!/usr/bin/perl |
Quote:
|
nope
this doesn't work either;
Code:
#!/usr/bin/perl |
The point about backticks (`) not single quotes (') is correct.
When you say it doesn't work, show how you ran it and what you got. Incidentally, I'd change the code Code:
#!/usr/bin/perl -w |
All times are GMT -5. The time now is 04:58 PM. |