[Pdx-pm] implicit hashref return gone awry

Rob Bloodgood robb at empire2.com
Mon Dec 5 16:57:31 PST 2005


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.


but it looks like a "regular" block, to perl.

make it:

      sub four {
          return {
              %{ one() },
              label    => 'Bar',
          };
      }


and now it looks like you're returning hashref, not processing a block
and falling off the end with a list value.

L8r,
Rob


More information about the Pdx-pm-list mailing list