desertman has asked for the wisdom of the Perl Monks concerning the following question:

Hi, Is anyone aware of a regex script that will parse and unformated list of snail uspto mail addresses. Seems like it would be a very common app. Thanks

Replies are listed 'Best First'.
Re: snail mail address processing
by toolic (Bishop) on Oct 21, 2009 at 22:37 UTC
      sorry my perl is rusty

      two questions:

      1. what is lmgtfy ?

      2. i "cpanned" Geo::StreetAddress::US but now I don't know what to do. There is no example script. How do I read a file into this? Is there a tutorial or documentation on how to utilize CPAN library functions for beginners anywhere?

      Thanks
        2. i "cpanned" Geo::StreetAddress::US but now I don't know what to do. There is no example script.
        CPAN module authors often tuck example scripts into their distributions. You just have to know where to look. From the Geo::StreetAddress::US link, click on the Geo-StreetAddress-US-0.99 link, then the MANIFEST link. There you will see 4 other links under a directory named 'eg' (which, I presume, is short for 'example'). manual_test.pl may give you a quick start.

        I have no idea if this module does what you need. But, now you should have a little better idea how to navigate CPAN.

        Is there a tutorial or documentation on how to utilize CPAN library functions for beginners anywhere?
        Tutorials
        Installing Modules
        Using Modules
        1. what is lmgtfy ?
        Should be self-evident if your follow the link. Otherwise, google lmgtfy :)
        OK i found the synopsis example , it makes more sense

        apparently the data needs to be comma separated

        i was hoping something more robust that would take any text file with clearly demarcated address, spaces, line returns, etc but not necessarily CSV, but also if its there, and rip out the address

        however, i still dont know what "lmgtfy" is

        this from synopsis of Geo::StreetAddress::US

        use Geo::StreetAddress::US;

        my $hashref = Geo::StreetAddress::US->parse_location( "1005 Gravenstein Hwy N, Sebastopol CA 95472" );

        my $hashref = Geo::StreetAddress::US->parse_location( "Hollywood & Vine, Los Angeles, CA" );

        my $hashref = Geo::StreetAddress::US->parse_address( "1600 Pennsylvania Ave, Washington, DC" );