Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
my %seen; open(FILE, '<', 'file.txt') or die "Unable to open file.txt for readin +g, $!"; while (<FILE>) { chomp; tr/0-9//cd; if (length $_ >=7 && length $_ <= 10) { $_ = sprintf("%010s", $_); $_ =~ s/(\d{3})(\d{3})(\d{4})/$1-$2-$3/; $seen{$_}++; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: phone number regex (new question)
by TomDLux (Vicar) on Mar 11, 2004 at 19:53 UTC | |
|
Re: phone number regex (new question)
by Roy Johnson (Monsignor) on Mar 11, 2004 at 22:21 UTC | |
by revdiablo (Prior) on Mar 11, 2004 at 23:12 UTC | |
|
Re: phone number regex (new question)
by pbeckingham (Parson) on Mar 12, 2004 at 05:06 UTC | |
|
Re: phone number regex (new question)
by wolfi (Scribe) on Mar 12, 2004 at 13:09 UTC |