while ( my $contact = pop(@names) ) { print "$contact\n"; print "Is this what you want? (y - n):"; $sel = ; last if $sel =~ /y/i; }