N, Guruguhan (GEAE, Foreign National, EACOE) wrote:
> Hi All,
>           I wanted to check whether the user input is only a number
> and does contain any alphabet/s anywhere i.e. starting, end or
> in-between. Can somebody tell me how to do this?

I assume you mean "does NOT contain any ..."

chomp(my $input = <STDIN>);
die "Invalid input\n" if $input =~ /\D/;

\D in a regex matches any non-digit character.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to