Re: how do I grep and have the matched single line in perl variable
- From: japhy@xxxxxxxxxxxx (Jeff 'japhy' Pinyan)
- Date: Fri, 23 Sep 2005 09:29:47 -0400 (EDT)
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`;
-- Jeff "japhy" Pinyan % How can we ever be the sold short or RPI Acacia Brother #734 % the cheated, we who for every service http://www.perlmonks.org/ % have long ago been overpaid? http://princeton.pm.org/ % -- Meister Eckhart .
- Follow-Ups:
- Re: how do I grep and have the matched single line in perl variable
- From: Manish Sapariya
- Re: how do I grep and have the matched single line in perl variable
- References:
- how do I grep and have the matched single line in perl variable
- From: Manish Sapariya
- how do I grep and have the matched single line in perl variable
- Prev by Date: RE: here tag and internal variable
- Next by Date: Re: here tag and internal variable
- Previous by thread: how do I grep and have the matched single line in perl variable
- Next by thread: Re: how do I grep and have the matched single line in perl variable
- Index(es):