#!/usr/bin/env perl use warnings; use strict; use 5.10.0; use Term::Choose qw(choose); my @array = ( 'a' .. 'z' ); my @new; for my $i ( 0 .. $#array ) { my $choice = choose( [ 'ok', 'ans Ende', undef ], { prompt => "<$array[$i]>", undef => 'Exit' } ); exit if not defined $choice; if ( $choice eq 'ans Ende' ) { push @array, splice( @array, $i, 1 ); next; } push @new, $array[$i]; say "@new"; }