in reply to subroutine return ternary output

Is $1 a typo? And why are you returning 2 while the original returned 1 on failure?