rajkrishna89 has asked for the wisdom of the Perl Monks concerning the following question:
Im trying a grep a variable which contains a word ( The word will be updated as the variable is used in a loop) ...
For eg the variable monk contains the following words:- node, post, Perl.
The snippet im using is
if ( grep /$Variable/, <$fh> )
$variable contains the word which i try to find it in the fh which is nothing but files..
The issue is $variable contains the word "node" the following words are getting grepped :- _node similarly for post , _post is also getting matched .. how to find the exact match or how to exclude the "_" in the search...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Exact Match - GREP
by tobyink (Canon) on May 13, 2012 at 07:36 UTC | |
|
Re: Exact Match - GREP
by choroba (Cardinal) on May 13, 2012 at 07:36 UTC | |
|
Re: Exact Match - GREP
by Mr. Muskrat (Canon) on May 13, 2012 at 13:43 UTC |