in reply to Re: Is there any other way to avoid greedy matching
in thread Is there any other way to avoid greedy matching

If you've already verified that the string contains no non-digit characters, it's a simple as
  /^\d{2}$/

Otherwise, something like this might work:
  scalar(() = $foo =~ /(\d)/g) == 2

-David

Update: Wow, what was I smoking?