[Melbourne-pm] Nested maps returning hash references
Toby Corkindale
toby.corkindale at strategicdata.com.au
Tue Oct 4 22:34:28 PDT 2011
OK, this is doing my head in.
I have two map functions that work perfectly well on their own:
map {
$f->can($_) ? ($_ => $f->$_) : ()
} qw (label name html);
map {
{
label => $f->label,
name => $f->name,
html => $f->html,
}
} @fields;
However when I combine them, it all goes pear-shaped, and I just get
back one huge, flat array, rather than an array of hashes.
map {
my $f = $_;
{
map {
$f->can($_) ? ($_ => $f->$_) : ()
} qw(label name html);
}
} @fields;
Any thoughts?
Cheers,
Toby
More information about the Melbourne-pm
mailing list