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.
|Replies are listed 'Best First'.|
Re^3: Counting the number of items returned by split without using a named array
by Hue-Bond (Priest) on May 03, 2006 at 13:38 UTC
by blazar (Canon) on May 03, 2006 at 13:47 UTC