Re: regex, number of matches



Dr.Ruud wrote:
>
> What I found hard to get, is the role of the '()' in the wc-words-line:
>
> $ret[1] += () = /\S+/g; # words
>
> After a while, I understood it as an anonymous array that is filled with
> the matches, after which its length is used to increase the words-count.

If it had been an anonymous array it would have been:

$ret[1] += @{[ /\S+/g ]}; # words



John
--
use Perl;
program
fulfillment
.