Multiple choice technology programming languages

What is the ouput of the following code snippet: \$mystring = "[2004/04/13] The date of this article."; if(\$mystring =~ m/(\d)/) { print "The digit is $1"; }

  1. The digit is 3

  2. The digit is 2

  3. The digit is 1

  4. None of the above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The regular expression (\d) matches the first single digit encountered in the string. In the string "[2004/04/13]...", the very first digit is '2'. Thus, $1 captures '2', printing "The digit is 2".