in reply to Run multiple shell commands on the same perl script
You can do like so:
NOTE:use warnings; use strict; for my $cmd(qw(ls ipconfig)){ system("$cmd"); }
- Please, check this How do I post a question effectively?
-
"..When I run the script below, it only picks the first commands.."
-
I used ipconfig instead of the OP ifconfig because I tested this on window OS.
"..The "exec" function executes a system command *and never returns*; use "system" instead of "exec" if you want it to return...."
Check also exec and system
If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me
|
---|
In Section
Seekers of Perl Wisdom