On 8/27/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote: > Hi, > > I want to implement longest prefix match in my code in perl, but am not able > to get started with it. I am sure, it can be easily achieved with the help > of regex in perl, but I haven't worked on it. Following is what I want to > do:- > > If the phone number is > +852xxxx ---> The country is Hong Kong > +853xxxx ---> The country is Macau. > > I have a list of 65 such countries and their codes. I have to read a > particular field in the CSV file, and on the basis of longest prefix match, > assign a country to it. > > > Thanks in anticipation, > > Mihir >
Don't reinvent the wheel (unless it is for fun or educational purposes): http://search.cpan.org/~dcantrell/Number-Phone-1.58/lib/Number/Phone/Country.pm -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/