123456
my $next_index = sub { my @array= (was, wie,wo,wann,wozu,wieso); return defined $array[$_[0]+1] ? $array[$_[0]+1] : $array[0];}$callback = $next_index->(2);