$res = qx/man patch/; my $dry_option; $dry_option = '--dry-run' if($res =~ /--dry-run/); $dry_option = '--check' if($res =~ /--check/);