This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
scalar(%h = (1,1,1,1)) should return 4, not 2
authorRuslan Zakirov <ruz@bestpractical.com>
Sun, 7 Oct 2012 22:30:54 +0000 (02:30 +0400)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 11 Dec 2012 16:59:39 +0000 (08:59 -0800)
commit231cbeb24ba077cbde643fc4d5178055c1464f5c
tree206ceaf12160a1b8ccb47af55e7aadd969b13321
parent6d70c686156da1532212fbc817c63c0a02bf894a
scalar(%h = (1,1,1,1)) should return 4, not 2

perldoc perlop says:

    a list assignment in scalar context returns the number of elements
    produced by the expression on the right hand side of the assignment

Behaviour was changed as side effect of
ca65944e8ff8fff6e36ea7476ba807be16cfe2a9 where goal was to fix
return value in list context.
ext/Hash-Util-FieldHash/t/11_hashassign.t
pp_hot.c
t/op/hashassign.t