I don't understand this following code:
defined(my $pid=fork) or die $!; unless($pid){ exec 'date'; die $!; } waitpid($pid,0);
when using fork,the fork function returns pid, which is non-zero number and true value. I don't know why I should use defined function in here. But without defined, this code just immediately die
In reply to using defined on fork by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |