The =()= does work with matches:
$ perl -lpe '($_=()=/\s+/g)++' foo 1 bar baz 2 foo bar baz 3
But I would use split, especially with the smart behaviour provided by the default ' ' argument.
In reply to Re^2: Counting the number of items returned by split without using a named array
by blazar
in thread Counting the number of items returned by split without using a named array
by Anonymous Monk
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |