sub input { my $input; # Just the 'my' here while ( 1 ) { $input = ; # Asssignment here chomp ( $input ); if ( $input !~ /\d/ ) { print "ILLEGAL INPUT\n"; next; } last; } return $input; }