use warnings; my $output = do { no warnings "exec"; `my_command -v` };