in reply to Regex: plucking numbers from a large string
I removed the "+" from after the \d, since you really only expect one digit for your extensions, right?my @counts; # since there are only 10 possible values, all # digits, why use a hash? while($largeStr=~/Tel: 06(\d)/g) { $counts[$1]++ }
After the loop is done, the @counts array should have the answers you're looking for.
--
Mike
Edit: Wow, foreach doesn't work, but while does. Wierd...
|
|---|