in reply to Validating Hex Numbers

The solution depends a bit on your problem. If you ever plan to treat the string as a hex number in Perl then my first take on the problem would be to use Perl's own hex() function to see if Perl thinks it's a hex number or not. This routine will return false for any complaints Perl might have, like integer overflow or non-portable value.
sub is_hex { my ($s) = @_; local $SIG{__WARN__} = sub { die }; return eval { scalar hex $s; 1 }; }
If you don't care about if Perl thinks it's portable and/or too large to be an integer then you can make it not warn about that through the warnings pragma (no warnings 'appropriate category';, see perllexwarn) or by handling the warnings in the warn hook:
local $SIG{__WARN__} = sub { /non-portable/i or /overflow/i or die for @_; };
Hope I've helped,
ihb