To follow up on that, I would come up with the best possible function I could come up with to normalize phone numbers, and start a test script that will test a list of phone numbers. As you feel the need to match weirder formats, edit your function to normalize them, run the test script to see if it still works for all cases and then add it to the application you are doing.
Also if the normalize_phone_number function is placed in a module you can use the Test.pm module to build your test script.
I think I would start by treating any non alphanumeric character as a separator, and substitute one or more separators by my normalized separator. then start from the right of the string, first separator after the 6 character is local number, next group is regional, and ... darn, forgot extensions. You're on your own :)
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link or
or How to display code and escape characters
are good places to start.