in reply to while/push to map, data structure confusion

A good way to resolve data structure confusion is to use Data::Dumper from CPAN and view your data structure:
use Data::Dumper; print STDERR "This is confusing: ",Dumper($someConfusingStructure),"\n +";

Then you can see exactly what you're dealing with and perhaps come up with a solution faster than you would be asking the general public.

In any case, the above posters are correct that a map cannot solve your problem without making things slower and more complicated. I can see it being done by nesting maps and putting extra conditions inside the map block, but that's much slower than a single loop and pushing arrays.