Syntactic Confectionery Delight | |
PerlMonks |
Hash initialization works, but why?by throop (Chaplain) |
on Jun 04, 2008 at 22:25 UTC ( [id://690266]=perlquestion: print w/replies, xml ) | Need Help?? |
throop has asked for the wisdom of the Perl Monks concerning the following question:
Brethren,
Here on perlmonks, I've picked up the nifty way of initializing a hash works the same as which has been very handy to me several times when I've had a pair of 'parallel' lists that I wanted to turn into a hash. But I don't understand why it works. I mean, @foo, %foo and $foo are three separate data-structures. @foo{@keys} = @values; looks like it's affecting @foo. But it isn't. It's affecting %foo. Howscome? I have an intuition that this has to do with (de)referencing of typeglobs, but I don't have nearly enough enlightenment. So I can copy the recipe by rote, but have insufficient insight into the Perl-nature of *foo. throop
Back to
Seekers of Perl Wisdom
|
|