Philip, while I always view your posts as a source of illumination,
I do want to point out one error in your reply to this person.
You wrote:

>> $good_tel_number = 1 if($tel_number =~ /^\d{10}$/);
>
> (Aside from the fact that your code doesn't match foreign telephone numbers
> because it needs exactly ten, it'll also match
> "this1is2not3a4telephone5number6in7any8country9I0know" because that string
> contains 10 digits....)

But clearly this is not the case.  Consider this snippet:

#!/usr/bin/perl -w
use strict;
my @array = ('123456789', '555-545-6723', '0123456789', '5554343',
             'this1is2not3a4telephone5number6in7any8country9I0know');
print $_, (/^\d{10}$/?" works!":" fails!"), "\n" foreach (@array);


You will get this output:

123456789 fails!
555-545-6723 fails!
0123456789 works!
5554343 fails!
this1is2not3a4telephone5number6in7any8country9I0know fails!


So, while I agree with all your other points, I'll disagree on this
one.  ^\d{10}$ will match only those cases where there are precisely
10 numbers and nothing else on the line.  This of course fails
miserably in many legal cases, not only overseas but even in the USA.
Just yesterday I called a number which required the usual ten digits,
plus an extra four for the extension.  And this regex breaks anytime
anyone uses dashes or parens or spaces to clarify the structure of
the number.

As you said so euphemistically, the submitted code is a ghastly hack.
Only in a web-programming book would an author be allowed to get away
with offering such awful code.

David
--
David Cassell, OAO                     [EMAIL PROTECTED]
Senior computing specialist
mathematical statistician



---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
         [EMAIL PROTECTED]

Reply via email to