coldy has asked for the wisdom of the Perl Monks concerning the following question:
I would like to grep @array for an exact match of $search, if I domy $search = "foo"; my @array = ("s1 bar", "s2 notfoo", "s3 foo")
grep will match both the 2nd and 3rd elements of @array as they both end in "foo", is it possible to only return an exact match for the last characters the same size of the search term? Cheers, Chrisgrep {/$search$/} @array
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: grep regex exact match last n positions
by NetWallah (Canon) on Apr 13, 2010 at 04:51 UTC | |
by coldy (Scribe) on Apr 13, 2010 at 05:21 UTC | |
|
Re: grep regex exact match last n positions
by ikegami (Patriarch) on Apr 13, 2010 at 04:51 UTC | |
|
Re: grep regex exact match last n positions
by jwkrahn (Abbot) on Apr 13, 2010 at 07:22 UTC | |
|
Re: grep regex exact match last n positions
by nvivek (Vicar) on Apr 13, 2010 at 05:36 UTC | |
by JavaFan (Canon) on Apr 13, 2010 at 07:02 UTC |