in reply to Re: Question on pattern matching
in thread Question on pattern matching

This also works:

if ($my_dat eq sprintf('%02d', do { no warnings; 0+$my_dat })) { # $my_dat only contains digits. # $my_dat is exactly two characters long. ... }