In which case you will also have to define "numbers" :) integers?, floats? enotation? Roman? Only ASCIIdigits, or also other Unicode numerals?
Let me assume simple integers and floats represented in ASCII (no triadsep, radixsep = '.', so valid numbers include 1234 and 0.23, but not DCVII, 2.34e12 or 1,234,567.00
my %count;
while (<FH>) {
$count{lc $_}++ for grep { !m{^[09]+(\.[09]+)?$} } m/\w+/g;
}
For a complete regular expression to integers and reals, I'd like to refer to Regexp::Common (see $RE{num}).
update: /me just realized that it is overly complex, as \w+ can only match integers without a triadsep, as . is not included in \w, reducing the loopline to
$count{lc $_}++ for grep { !m{^[09]+$} } m/^\w+$/g;
Enjoy, Have FUN! H.Merijn
