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).my @x = "abcdefgh" =~ /(.)(.)/g;
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Size of @+
by roho (Bishop) on Oct 03, 2002 at 17:33 UTC | |
by Chmrr (Vicar) on Oct 04, 2002 at 03:26 UTC | |
Re: Size of @+
by tommyw (Hermit) on Oct 03, 2002 at 15:58 UTC | |
by blakem (Monsignor) on Oct 03, 2002 at 19:27 UTC | |
by merlyn (Sage) on Oct 03, 2002 at 19:43 UTC | |
Re: Size of @+
by cluka (Sexton) on Oct 05, 2002 at 21:12 UTC |