--- /dev/null
+#!/usr/bin/env perl
+use 5.012;
+use warnings;
+
+my %cc; # map of country code to info array
+
+while (<>) {
+ /<pre>/ .. /<\/pre>/ or next; # data is in preformatted block
+ m{
+ \A (?<continent> [A-Z]{2})
+ \h (?<codea2> [A-Z]{2})
+ \h \S* \h \d* # skip other iso codes
+ \h (?<name> .+)
+ }x or next;
+ $cc{ lc $+{codea2} } = [ $+{name}, "c-\L$+{continent}" ];
+}
+
+use Data::Dump 'dd';
+$Data::Dump::INDENT = '';
+dd \%cc;
+
+__END__
+
+=head1 NAME
+
+mkcountryinfo - Create Perl include of country info from Wikipedia page
+
+=head1 SYNOPSIS
+
+ curl http://en.wikipedia.org/wiki/List_of_sovereign_states_and_dependent_territories_by_continent_%28data_file%29 |
+ tools/mkcountryinfo > countries.inc.pl
+