the current hash being initializedThat hash is necessarily empty until the entire value on the right (the map) is completely computed. You can't start shoving values into there because you can't alter the existing data, or else things like this woudn't work:
In this case, you can't start altering @a during the map, because @a might be getting shorter, and then you wouldn't have the right values on the right.@a = map { $a[$_] > 1 ? $a[$_] * 2 : () } 0..$#a;
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
In reply to Re^3: Is it possible to use key/values of a Hash/Hash ref while it's being initialized?
by merlyn
in thread Is it possible to use key/values of a Hash/Hash ref while it's being initialized?
by shiza
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |