Re: Unknown level of hash
Alexandre Jousset <[email protected]>
| Newsgroups | gmane.comp.lang.perl.fun |
|---|---|
| Message-ID | <[email protected]> |
Andrew Pimlott wrote:
>>>(You should be able to write the first one as
>>>
>>> ${fold_left { \${$_[0]}->{$_[1]} } \$hash, @a} = 1;
>>>
>>>but Perl complains for no reason I can see.)
>>
>> Of course, the '{}' operator is a hash ref generator, not an
>> anonymous sub declarator as 'sub {}' is...
>
>
> But I declared fold_left with a prototype (&@), which should allow
> dropping the "sub". (And yes, in my actual program, I put this
> declaration above the use, so the prototype is visible.) It works for
> the "get the value back out" example, but somehow it doesn't seem to
> work inside the reference (${...}). perlref doesn't say there are any
> restrictions on what you can put inside ${...}, so I'm mystified.
Ok, mea culpa, I haven't seen the prototype... And in fact I didn't
know this behavior :-) Thank you for teaching it to me...!
--
\^/
-/ O \----------------------------------------
| |/ \| Alexandre (Midnite) Jousset |
-|___|----------------------------------------