### gather schachteln? { my $list_ref=[]; sub gather (&){ my $code_ref=shift; my @list=(); my $safe=$list_ref; $list_ref=\@list; &$code_ref; $list_ref=$safe; return @list; } sub take { push @$list_ref, @_; return; } } #- simple test @x= gather{ take [$_] for (1..3) }; print Dumper \@x; #- nested test @x=(); @x= gather{ take gather{ my $x=$_; take [$_,$x] for (1..$x) } for (1..5); }; print Dumper \@x;