From 43107005cf3fc4356e72a2820e623c6983309e6b Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 1 Nov 2010 18:24:45 +0000 Subject: importing upstream 1.41 --- examples/demo.pl | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 examples/demo.pl (limited to 'examples') diff --git a/examples/demo.pl b/examples/demo.pl new file mode 100755 index 0000000..1ea8f11 --- /dev/null +++ b/examples/demo.pl @@ -0,0 +1,32 @@ +#!/usr/bin/perl + +# demo script for Locale::SubCountry + +use strict; +use Locale::SubCountry; + +# For every country +# list the country name +# if any subcountries, list each code and full name on a new line + +my $world = new Locale::SubCountry::World; +my @all_countries = $world->all_full_names; + +my %all_letters; +foreach my $country ( sort @all_countries ) +{ + print "\n\n$country\n"; + my $current_country = new Locale::SubCountry($country); + + # Are there any sub countires? + if ( $current_country->has_sub_countries ) + { + # Get a hash, key is sub country code, value is full anme, such as + # SA => 'South Australia', VIC => 'Victoria' ... + my %sub_countries_keyed_by_code = $current_country->code_full_name_hash; + foreach my $code ( sort keys %sub_countries_keyed_by_code ) + { + printf("%-3s : %s\n",$code,$sub_countries_keyed_by_code{$code}); + } + } +} \ No newline at end of file -- cgit v1.2.1