in reply to regexp - character class containing zero does not find zero

The value '0' evaluates to false in a boolean context so your and test fails. Why not use defined() or m/^./ to test for the presence of a $test value?