in reply to Collect numbers without the text

This being perl, I recommend using regexes.

You can look at Regexp::Common, it already contains regexes that match numbers in various formats.