* Moritz Lenz <moritz@casella.verplant.org> [2008-09-01 13:10]:
> $ perl -wMstrict -E "say scalar (my @a = 'aaa' =~ /./g)"
> 3
> $ perl -wMstrict -E "say scalar (my @a = 'aaa' ~~ /./g)"
> 1
>
> (from http://www.perlmonks.org/?node_id=708150 ), both with
> perl 5.10.0 and blead.
>
> Is this intentional? If yes, we should add s small warning to
> perlsyn. I'd prefer to have =~ and ~~ behave the same in list
> context.
But then ~~ against a string in list context would be different
from ~~ against a regex in list context. Is it more important
for ~~ to be consistent with =~ or more important for it to be
consistent with itself? (This is not a rhetorical question. I
suppose the answer is “itself,” but I have not thought of any
solid argument other than that self-consistency for the sake
of self-consistency is an obvious-seeming right choice.)
Regards,