Wikipedia article titles in different languages

This program gets the Japanese language names for the chemical elements from Wikipedia using the CPAN module WWW::Wikipedia::LangTitles as well as Chemistry::Elements.

#!/home/ben/software/install/bin/perl
use warnings;
use strict;
use utf8;
use FindBin '$Bin';
use WWW::Wikipedia::LangTitles 'get_wiki_titles';
use Chemistry::Elements;
binmode STDOUT, ":utf8";
my %n = %Chemistry::Elements::names;
for my $k (sort {$a <=> $b} keys %n) {
    my $e = $n{$k}[1];
    print "$e ";
    my $map = get_wiki_titles ($e);
    print $map->{ja}, "\n";
    # Limit the rate of requests to prevent server overload.
    sleep (2);
}

(download)


Copyright © Ben Bullock 2009-2017. All rights reserved. For comments, questions, and corrections, please email Ben Bullock (benkasminbullock@gmail.com). / Privacy / Disclaimer