in reply to question about the star(*) quantifier
The problem is that /(\d*)/ allows zero or more digits, so it will match every string. Perl will first attempt to match starting at the beginning of the string, and match as many digits as possible. So it looks at the beginning, sees that it matches zero digits, and succeeds. The simple solution would be to use /(\d+)/ (which will force it to go until it finds at least one digit). Depending on your data and exact situation, there may be other approaches that would work better for you.