On Wed, Feb 20, 2008 at 5:50 PM, yitzle <[EMAIL PROTECTED]> wrote: snip > my $var = grep {/This|That/}, `cmd --arg1 --arg2; > (Did I do this right? I'm not very familiar with grep) snip
That is mostly correct. You are using the grep function in scalar context, so it will return the number of items matched rather than the items themselves. You need a join to make it work the way it was intended. Also, you don't use a comma after the block and the backticks should be terminated (which is why I like qx// better, it is easier to see) my $var = join '', grep { /This|That/ } qx(cmd --arg1 --arg2 2>/dev/null); On a related note, my solution implements an egrep -v rather than an egrep. It should have been my $var = ''; while (<$out>) { next unless /This|That/; $var .= $_; } -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/