$output = `some command-line program`; if ($output =~ /looking for this/) { .. do this }