Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

vsergu (505)

vsergu
  (email not shown publicly)

Journal of vsergu (505)

Sunday January 20, 2002
05:50 PM

@h{@a}++ ?

[ #2278 ]

Someone on DC.pm who was trying to understand slices has run across something odd. Autoincrementing a hash slice (or for that matter autodecrementing an array slice) is not a syntax error. It increments the last element in the slice and autovivifies the others, at least in 5.6.1 and 5.005_03. There's now disagreement on the list about whether it's a bug. Does it make any sense to anyone else?

It may be related to something else that does seem to have been a bug, since it was fixed: ($a, $b, $c)++ isn't a syntax error in 5.005_03 but it is in 5.6.1.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.