@a = (1,5,7,9,32,197,8,4,5); # (pretend this is dynamically generated) @b = map {[ $a[2*$_], $a[2*$_+1]||() ]} 0 .. int $#a/2;