while ( @array ) { my $el = shift @array; my $choice = choose( [ 'ok', 'ans Ende', undef ], { prompt => "<$el>", undef => 'Exit' } ); exit if not defined $choice; if ( $choice eq 'ans Ende' ) { push @array, $el; next; } push @new, $el; say "@new"; }