Add pure-perl implementation of is_sub_constant()