go ahead... be a heretic | |
PerlMonks |
Re: (Mis)Understanding <c>grep...eq $_<c>by jethro (Monsignor) |
on Feb 24, 2009 at 06:49 UTC ( [id://745915]=note: print w/replies, xml ) | Need Help?? |
grep doesn't search in strings, it searches arrays or lists. It makes no sense to use it on scalars. You give grep a list, and an operation to execute on each element of the list. For example:
grep is sort of a loop and what you did was create a loop that always loops only once. So the following two lines are practically equivalent
In Section
Seekers of Perl Wisdom
|
|