in reply to Regex Pattern Problem

I may be wrong, I am kind of new at this, but I believe there is one more problem with your regex. If you are trying to match 5 and only 5 digits, you need to drop the comma as well. Page 68 of the nutshell book says the {n,} will match at least 5 or more. You need to use {5} to match 5 and only 5 digits.

unless ($num =~ /^\d{5}$/) {


Even with an anchor /^\d{5,}$/ will match any line that starts with at least 5 numbers but contains more than 5 numbers.

Update: I see after re-reading your problem that you do want 5 or more. I was to excited about regex. It is the topic of discussion this week in a class I am taking.

Yoda