1

I have next code:

print   for @{ $events->{ $name } };

When $events is empty hash I got $name key which value is empty array []

Why autovivification works despite on that I just access element and assign nothing to it?

Eugen Konkov
  • 22,193
  • 17
  • 108
  • 158

1 Answers1

0

Assigning doesn't autovivify; evaluating as an lvalue so that you can assign does.

Foreach's list expression is evaluated as an lvalue to allow $_ = 1 for @a;

ikegami
  • 367,544
  • 15
  • 269
  • 518