PassRegex($str =~ /b/i, 'parm2', 'parm3');
I believe that regex is evaluated in list context, not scalar context. In that case, the
m operator returns an empty list when there is no match. From
perlop:
an empty list is returned upon failure.
An empty list is a list with no items. So, when there is no match, you actually pass a list of 2 items to your sub, not 3. You could use this to force scalar context:
PassRegex(0+($str =~ /x/i), 'parm2', 'parm3');
Or, be more explicit with:
PassRegex($str =~ /x/i ? 1 : 0, 'parm2', 'parm3');