[Pdx-pm] implicit hashref return gone awry

David Wheeler david at kineticode.com
Mon Dec 5 17:19:40 PST 2005


On Dec 5, 2005, at 5:13 PM, Randall Hansen wrote:

> thanks to David and Rob for the same answer at the same time.  my
> real question, though, is what makes perl think that &four is
> returning a block and &three a hashref?

The "return" disambiguates it. A bare block is always a block unless  
it's assigned to something. The return assigns it to a variable set  
up by the caller. For all practical purposes, a bare block is the  
same as do {}.

HTH,

David



More information about the Pdx-pm-list mailing list