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


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

Note that both of your solutions don't report an error for e.g. 'aaaaaaaaa0-' and 'aaaaaaaaaaaaaaaaaaa', which are invalid as per the OP's code.