
List forms for system, exec, etc
Perl's system and exec functions can take lists instead of strings:
$filename = "a file containing spaces";
# Won't work
system "/bin/rm $filename";
# Better way
system("/bin/rm", $filename)==0 or die "rm failed";
# Exec example
exec "/opt/bin/doit @args";
# Better
exec "/opt/bin/doit", @args;
die "exec failed";
Copyright 2003, Bri Hatch of Onsight, Inc.
Presented at SPUG, 2003.
Presentation created using vim and MagicPoint.