in reply to Re: running programs from PERL
in thread running programs from PERL
The temporary @args array is not needed, use system($dir,'&').
That's right. But it doesn't do much harm either... And in case you want to debug what is actually being passed to system, you can simply add a print @args without restructering the code, instead of duplicating the argument list and trying to keep both in sync when you make changes. This is especially handy with more unwieldy (OT: or would you say unwieldier?) argument lists. You never know when you'll need it...
my $prog = 'myprog'; my $file = 'myfile'; my @useropts = qw(-bar -baz); my @args = ("/path/to/$prog", '-foo', @useropts, $file, '-o', "$file.o +ut"); print "system(): @args\n"; # debug system (@args); # vs. print join(" ", "system():", "/path/to/$prog", '-foo', @useropts, $fil +e, '-o', "$file.out"), "\n"; # debug system("/path/to/$prog", '-foo', @useropts, $file, '-o', "$file.out");
|
|---|