R
Robert Wallace
i'm trying to run a system command like ls,dir,ping,uptime, etc...
I tried the following two methods. both works. both produce the same
output.
is there a difference? is there a situation where I would use one over
the other?
I guess the open allows me to do more on-the-fly stuff.
what else?
# this one ##########################################################
open (SYS, "/temp/uptime.exe |");
while($the_sys = <SYS>){
$the_sys =~ s/\015\012/<br>\015\012/g;
print $the_sys . "<br>\n";
}
close (SYS);
# and this one
##########################################################
$sys=`/temp/uptime.exe`;
$sys=~s/\015\012/<br>\015\012/g;
print $sys;
I tried the following two methods. both works. both produce the same
output.
is there a difference? is there a situation where I would use one over
the other?
I guess the open allows me to do more on-the-fly stuff.
what else?
# this one ##########################################################
open (SYS, "/temp/uptime.exe |");
while($the_sys = <SYS>){
$the_sys =~ s/\015\012/<br>\015\012/g;
print $the_sys . "<br>\n";
}
close (SYS);
# and this one
##########################################################
$sys=`/temp/uptime.exe`;
$sys=~s/\015\012/<br>\015\012/g;
print $sys;