New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@_ autovivifies hash slices #8153
Comments
From @kenahooThis is a bug report for perl from ken@mathforum.org, As the following three one-liners demonstrate, perl is autovivifying
The main difference is between the first two examples, which my Credit goes to Thomas L. Shinnick, who figured out why -Ken Perl Info
|
From @doyThis is still true in 5.16. |
The RT System itself - Status changed from 'new' to 'open' |
From @demerphqOn 21 June 2012 19:47, Jesse Luehrs via RT <perlbug-followup@perl.org> wrote:
But why is it a bug? Afaik it is supposed to happen. sub one { $_=1 for @_ } one(@foo{qw(x y z)}); print $_,":", $foo{$_}, $/ for keys %foo; __END__ y:1 -- |
From @doySure, it's clearly necessary in that case. But: Sure, it's clearly necessary in that case. But:
sub nop { }
my (%foo, %bar);
nop(@foo{'a', 'b'});
nop($bar{'a'}, $bar{'b'});
say "foo:";
say for sort keys %foo;
say "bar:";
say for sort keys %bar;
__END__
foo:
a
b
bar: I don't see a reason why -doy |
From @demerphqOk, I see. That makes sense. Maybe rename the bug? Yves |
From @cpansproutThis is on my to-do list, but rather low. Please leave it open if you will. -- Father Chrysostomos |
From @cpansproutIn case someone wants to beat me to it, it’s matter of extending defelem -- Father Chrysostomos |
From ruz@bestpractical.comOn Tue, Jun 18, 2013 at 8:40 AM, Father Chrysostomos via RT <
As far as I recall similar situation applies to for loops: perl -E '1 for @h{qw(1 2 3)}; say %h' But it spreads over more operations: perl -E '1 for $h{a}, $h{b}; say %h' Sorry, if it's not releated. |
Migrated from rt.perl.org#37441 (status was 'open')
Searchable as RT37441$
The text was updated successfully, but these errors were encountered: