[Melbourne-pm] Nested maps returning hash references

Andrew Pam andrew at sericyb.com.au
Tue Oct 4 22:51:50 PDT 2011


On 05/10/11 16:46, Andrew Pam wrote:
>>    map {
>>        my $f = $_;
>>        {
>>            map {
>>                $f->can($_) ? ($_ => $f->$_) : ()
>>            } qw(label name html);
>>        }
>>    } @fields;
>>
>>
>> Any thoughts?
> 
> Actually looking more closely, the braces around the inner map in the
> final example look like they're being interpreted as a block, not as an
> anonymous hash constructor.

Note:  Putting a unary "+" in front of the open bracket should turn it
into an unambiguous hash constructor.

Hope that helps,
		Andrew
-- 
Andrew Pam <andrew at sericyb.com.au>
Serious Cybernetics


More information about the Melbourne-pm mailing list