@c = map { "$a[$_]-$b[$_]" } (0..(($#a > $#b) ? $#a : $#b)); # And a more twisty way... my $iterator; { my $i = 0; $iterator = sub { ($i = 0, return undef) if (@_); return undef if ($i > $#a and $i > $#b); return ("$a[$i]-$b[$i]",$i++)[0]; }; } push @c, $_ while ($_ = $iterator->());