http://www.perlmonks.org?node_id=255818


in reply to •Re: Re: •Re: Checking for single digit
in thread Checking for single digit

Actually, considering chomping was not done, the original answer, /^\d$/ would be correct, unlike your answer, which would never match, as there would always be the trailing newline.

The fact that $ can match just before a trailing newline makes cases like this "do what I mean".

Abigail