I changed it slightly in that it will only return input if $input is a number. Your example would return "spam9" as good input.sub input { my $input; print "ILLEGAL INPUT $input\n" while ( chomp($input = <STDIN>) and $input !~ /^\d+$/); return $input; }
In reply to Re: my() troubles
by lemming
in thread my() troubles
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |