in reply to references // nested data structure

OK, This is the code :

#!/usr/bin/perl -w use strict; my %stuff; while(<DATA>) { chomp; my ( $country,$state,$city) = split /:/; push @{$stuff{$country}->{$state}},$city; } foreach my $country ( keys %stuff ) { print "The states in $country are ",join ",",keys %{$stuff{$country +}},"\n"; foreach my $state ( keys %{$stuff{$country}} ) { print "The cities in $state are ", join ",", @{$stuff{$country}->{$state}},"\n"; } } __DATA__ USA:CA:Los Angeles USA:CA:San Francisco USA:NY:New York CAN:Alb:Edmonton CAN:Alb:Calgary

Now read perldsc and come back if you have any questions :)

/J\