Capturing parens will return a list of the matched results. In scalar context, a list returns the length of the list (
says, in scalar context, the m// operator returns true or false). So
to "C". Returning
in the subroutine explicitly returns the correct thing no matter the context.
will argue that even with this simple regex, you should handle the case where the argument does not match the regex (e.g. the string has newlines, or does not contain even one character, etc).