use Shell cmdname => { exe => '/path/to/executable', return => 'pid', }, othercmd => { return => 'handle', }; # ... my $pid = cmdname(@params) or die "... $^E"; my $handle = othercmd( @params2); while (<$handle>) { ... } close $handle;