This assumes each element of @AoA is either an arrayref, or an undefined value.@flat = grep {defined} map {@$_} grep {$_} @AoA;
I'm not the biggest fan of using EXPR ? LIST : () inside a map just to avoid writing grep.
In reply to Re: Flatten sparse AoA
by JavaFan
in thread Flatten sparse AoA
by FloydATC
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |