# Do the thing my @results = `command`; # Look for the stuff my @foo = grep /foo/ @results; # Did we find it? if (0 == @foo) { print "The command didn't find 'foo'\n"; } else { print "Found 'foo'!\n"; }