in reply to Searching text files

Combining the above two great ideas, I would suggest not just a straight-forward database, but I would also split up the numbers into area code, exchange, extention. (And, if you want, country code - but sounds like you're just dealing with the US, so this would always be '1'.) This would allow the database to also set up indexes on area code and exchange for faster lookups. Ok, you have to tell the database to create indexes, but then you'll be able to do so.

Replies are listed 'Best First'.
Re^2: Searching text files
by demerphq (Chancellor) on Sep 15, 2006 at 10:38 UTC

    Off Topic a Bit

    Area codes, exchanges and extensions are US/Canada/Carribean concepts. Very few other areas use them. Germany for example uses over four thousand prefixes to represent local dialing zones, but they are not analagous to exchanges nor to area codes (and are of variable lengths). If you design your software with 3-3-4 in mind your software isnt going to work anywhere else in the world except maybe Switzerland (who use the NA system internally). My own telephone number is 11 digits for instance, and thats NOT including the country code. I know of peope who entire number is only 6 digits.

    I would say that indexing based on the full CLI is the best, and most portable.

    ---
    $world=~s/war/peace/g