Thanks a lot Jeff.
Sorry for posting the partial code. I should take care next time.

The error that I made was to receieve the output of `my_utility` in scalar
my $out = `my_utitlity`.

After changing it to list as
my @out = `my_utility` and using grep on it worked like charm.

I didnt correctly interpret the perl-grep man page.

Thanks for help.
Regards,
Manish


On 09/23/2005 06:59 PM, Jeff 'japhy' Pinyan wrote:
On Sep 23, Manish Sapariya said:

I want to have pure perl equivalent of following:

my $out = `my_utility | grep manish`;

which will give me the lines containing manish in the output
of my_utility in variable $out.


You'd use the aptly-named grep() function in Perl to get only those elements returned by `my_utility` that have 'manish' in them:

  my @wanted = grep /manish/, `my_utility`;


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to