"be consistent" | |
PerlMonks |
Re^3: How can I access the number of repititions in a regex?by Errto (Vicar) |
on Mar 11, 2008 at 20:36 UTC ( [id://673610]=note: print w/replies, xml ) | Need Help?? |
I understand that the empty () imposes list context on the right...correct ...making the match return the number of matches.Not quite. The match returns a list of matches. A list assignment in scalar context returns the number of elements in the list, regardless of the number of those elements that actually get assigned to anything (in this case, zero). So the "5" doesn't propagate. It's the use of the assignment in scalar context that creates the "5".
In Section
Seekers of Perl Wisdom
|
|