in reply to Checking for single digit
In your match try to use the special regexp anchors ^ and $:
From the Perl regular expression tutorial (perlre), the "^" and "$" are defined as:
Update: threw in some perldoc definitions for your viewing pleasure :)
_____________________
if ($input =~ /^[0-9]$/) { print "input was a single digit number\n"; } else { print "input wasn't a single digit number\n"; }
From the Perl regular expression tutorial (perlre), the "^" and "$" are defined as:
Unless they are used, Perl will look for a match anywhere within your $input string! ;-)^ Match the beginning of the line $ Match the end of the line (or before newline at the end)
Update: threw in some perldoc definitions for your viewing pleasure :)
_____________________
# Under Construction
|
---|
In Section
Seekers of Perl Wisdom