On Jul 28, Keenan, Greg John (Greg)** CTR ** said:
sub getDate {
print "start date\n";
if ( system("/bin/date") ) {
print "can't get date\n";
exit(2);
}
print "finish date\n";
}
system() executes a command, and returns the shell's error code. 0
indicates success, non-0 indicates failure.
Keenan, Greg John (Greg)** CTR ** wrote:
> Hi,
>
> Can someone explain the difference between backticks and system when
> evaluated in this if statement:
>
The difference really isn't specific to this context, it is the inherent
difference between the two that is affecting the outcome.
perldoc -
Hi,
Can someone explain the difference between backticks and system when
evaluated in this if statement:
sub getDate {
print "start date\n";
if ( system("/bin/date") ) {
print "can't get date\n";
exit(2);
}
print "finish date\n";
}
Returns the following:
start date
Thu Jul 28 12:13:5