use Shell cmdname => { exe => '/path/to/executable', capture_stderr => 1, params => [ '-foo', \1, '-bar', \2], }; # ... cmdname( $foo, $bar); # calling # /path/to/executable -foo '$foo' -bar '$bar' 2>&1