The issue is that an array (or hash, or list) slice in scalar context returns the last element of the slice. I feel like this should be documented in perldata but a quick read of it just now didn't reveal any such indication.perl -e"my @a=qw/a b c/; print scalar @a[0..2]" c
In reply to Re^3: regexp list return 5.6 vs 5.8
by Errto
in thread regexp list return 5.6 vs 5.8
by Sixtease
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |