1 |
system("shellscript"); # dispatchs shellscript to be execute by /bin/sh and anything allowed by shell is allowed in argument
-
system returns code returned by shellscript
|
2 |
system("date > tempfil"); # executes UNIX command date returning standard output from date to file tempfil in current directory
|
3 |
system("rm *") && die ("not allowed\n"); # terminates if error in system call as shell programs return nonzero if failure (opposite of open and most PERL commands)
|
4 |
Variable Interpolation is done in double quoted arguments and so one can include Perl variables in arguments of system
|
5 |
$prog="nobel.c"; system("cc -o $prog"); # (I) is equivalent here to
|
6 |
$ccompiler="cc";
|
7 |
system($ccompiler,"-o","nobel.c"); # (II) but in general not identical as in first form (I) shell interprets command list but in second form (II) the arguments are handed directly to command given in first entry in list given to system
|