in reply to Question on pattern matching

To test if the string is exactly two digits, anchor beginning and end and use a quantifier,

if ($my_dat !~ /^\d{2}$/) { # some code here }
The !~ op negates the match so that the bracketed code is executed if $my_dat is different from two digits.

After Compline,
Zaxo