[Pdx-pm] implicit hashref return gone awry

David Wheeler david at kineticode.com
Mon Dec 5 16:58:31 PST 2005


On Dec 5, 2005, at 4:49 PM, Randall Hansen wrote:

> this isn't working the way i expect, which means i have an
> opportunity for education :)
>
>      sub four {
>          {
>              %{ one() },
>              label    => 'Bar',
>          };
>      }
>
> i expected it to return a hashref, but it returns a list.  this
> appears to be related to the de-referencing of &one, since other
> similar situations do return a hashref.  full code below illustrates
> what i mean.

No, I think it's just because it's not a hash ref you have there, but  
a block. Just add a "return" like in three() and you're good to go.

Best,

David


More information about the Pdx-pm-list mailing list