http://qs321.pair.com?node_id=11118433


in reply to Re^2: Efficient way to verify scalar contents
in thread Efficient way to verify scalar contents

Out of curiosity, I tried tr/// instead of regex, much faster :)

sub validatetr { local $_ = shift; length >= 20 ? 1 : !tr/a-z// || !tr/A-Z// ? 0 : length >= 16 ? 1 : !tr/0-9// ? 0 : length >= 12 ? 1 : !tr/a-zA-Z0-9//c ? 0 : length >= 8 ? 1 : 0; }