perl -le "my ($first) = grep {/bar/} (qw(foo bar baz)); print $first"