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

Thanks very much everyone! I have gotten the code to work! I went with the following coding:
my @lines = grep /$prop/, <FILE>;
This seems to give the result I was looking for, though it's not exactly identical to any of the great solutions you all gave. Anyway thanks for curing my ignorance of grep - at least partially :)

Replies are listed 'Best First'.
Re^3: storing grep output to variable
by wolv (Pilgrim) on Jun 09, 2004 at 13:27 UTC
    That's the solution I would use myself. I'd just like to make a note that FILE type filehandles are global. Instead of globals you should use a lexical filehandle: open my $file, '<', $filename or die $!. See perldoc -f my and perldoc perlsub (Private Variables via my()) for an explanation of globals and lexicals.