my $prog = 'myprog'; my $file = 'myfile'; my @useropts = qw(-bar -baz); my @args = ("/path/to/$prog", '-foo', @useropts, $file, '-o', "$file.out"); print "system(): @args\n"; # debug system (@args); # vs. print join(" ", "system():", "/path/to/$prog", '-foo', @useropts, $file, '-o', "$file.out"), "\n"; # debug system("/path/to/$prog", '-foo', @useropts, $file, '-o', "$file.out");