Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Perl Module for identifying country name

by frozenwithjoy (Priest)
on Aug 03, 2012 at 15:36 UTC ( #985266=note: print w/replies, xml ) Need Help??


in reply to Perl Module for identifying country name

It seems like the biggest hurdle is getting a list of countries. To overcome this, you could use Locale::Country to do: @country_names = all_country_names();

Then you could do something like put the countries in one hash and the words from the file in another hash and look for overlapping keys. use List::Compare:

$lc = List::Compare->new( \@country_names, \@words_in_file ); @countries_in_file = $lc->get_intersection;

Edit: Now that I think about it a little more, it might be better to use your array of country names to grep through your file contents (after replacing new lines with spaces) to avoid issues with multi-word countries names.

Replies are listed 'Best First'.
Re^2: Perl Module for identifying country name
by maheshkumar (Sexton) on Aug 04, 2012 at 23:54 UTC

    Already used Locale::Country to put all names of countries in an array and i am getting the countries that appear in a file name :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://985266]
help
Chatterbox?
[Corion]: Nice to see that the kids have some understanding of important things that happen and the appropriate behaviour :)
[marto]: at times mine surprise me with this behavior :)
[Corion]: I mean, in a way it would be nicer+easier if they always where that obedient, but it's comforting to see that they are when it matters, at least for now ;)

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (9)
As of 2016-12-08 09:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (138 votes). Check out past polls.