sub split_array_in_two { ([@_[0..$#_/2]], [@_[$#_/2+1..$#_]]); } for (0..5) { print map("<@$_>", split_array_in_two(1..$_)), "\n"; }