while ( 'reading...' ) { print "\nPlease enter a number: "; my $in = ; do { push @in , $in; next; } unless $in =~ m/q/i; last; } chomp @in;