good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Size of @+by merlyn (Sage) |
on Oct 03, 2002 at 15:49 UTC ( [id://202550]=perlmeditation: print w/replies, xml ) | Need Help?? |
OK, I've seen this go by (incorrectly) in the CB twice in a week, so I'm going to post a note on it so I can refer to it again and again.
After this code: the size of @+ is three elements, since it records only the most recent complete regex match, with ending position info for $&, $1, $2 (3 elements total). The values are (8, 7, 8). The size of @x is indeed eight elements: the cumulative total of how many different memories matched for all matches (four matches, two apiece). There. Let's please have no more advice in the CB that the way to get the "number of matches" is to look at @+. Thank you. -- Randal L. Schwartz, Perl hacker
Back to
Meditations
|
|