$x = `echo foo`; #### $ cat t.pl use strict; use warnings; print "Let's do a command:\n"; my $x = `echo foo`; print "OK, command is done!\n\n"; print "Now let's see what we captured:\n<$x>\n"; #### $ perl t.pl Let's do a command: OK, command is done! Now let's see what we captured: #### print $x; #### my @results = `command`; #### my @foo = grep /foo/ @results; #### if (0 == @foo) { print "The command didn't find 'foo'\n"; } else { print "Found 'foo'!\n"; } #### # 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"; }