sub GetLGE { use Capture::Tiny qw/ capture /; local %ENV; delete @ENV{'PATH', 'IFS', 'CDPATH', 'ENV', 'BASH_ENV'}; $ENV{'PATH'} = '/bin:/usr/bin'; my @args = ( $^X, 'LGE.cgi' ); push @args, ...; untaint($_) for @args; my($stdout, $stderr, $exit) = capture { system { $args[0] } @args; };; if( $exit ){ die "got the exit( $exit ) and stderr: $stderr\n "; } return $stdout; }