in reply to Re: Make CSV list from values in AoH
in thread Make CSV list from values in AoH
All your solutions seem to work to my original spec's, thanks!
Sorry to report that I forgot to mention that if there are no names, the output should be 2 single quotes (see update in my first post).
I've come up with this, which is based on your 1st solution:
$csv = "'" . (join "','", map{$_} map{$AoH[$_]{name}} 0..$#AoH) . "'";
or more simply:
$csv = "'" . (join "','", map{$AoH[$_]{name}} 0..$#AoH) . "'";
or even:
$csv = "'" . (join "','", map{$_->{name}} @AoH) . "'";
BTW, how do I merge the 2 maps you mentioned into 1?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Make CSV list from values in AoH
by LanX (Saint) on Aug 17, 2018 at 23:27 UTC | |
by tel2 (Pilgrim) on Aug 17, 2018 at 23:40 UTC |