in reply to Re: storing grep output to variable
in thread storing grep output to variable

I could easily be doing something very odd - I only started learning Perl a few days ago. Is grep not a Perl function?
What I am trying to do is to retrieve the line of my file that contains the variable $prop, which is fed in on the command line, and store that entire line in a variable. When I try implementing the code that pelagic sent, I get the entire file output, instead of just the one line I want - odd since the input string is unique.

Replies are listed 'Best First'.
Re^3: storing grep output to variable
by pbeckingham (Parson) on Jun 08, 2004 at 19:05 UTC

    Yes, grep is a Perl function, but you are doing this:

    `grep ...`
    and the backtick operators invoke a shell to run grep, which is also a Unix system utility.