elavazhagan perl wrote:
> Hi......
> 
> Thanks Rob,with ur code ,Now I can display all the countries with
> regions.Now i would like to display only countries specific to the region.
> We can split the data and assign into two different arrays.Let me know is
> there any specific way to retrive the data ??
> Thanks a lot........
> 
> 
> 
> #! /usr/perl/bin
> use strict;
> my %Regions = (
>  Europe => [
>    'Belgium',
>    'Denmark',
>    'France',
>    'Germany',
>    'Great Britain',
>    'Hungary',
>    'Portugal',
>    'Russia',
>    'Spain',
>    'Sweden',
>    'Turkey',
>  ],
>  Asia => [
>    'Australia',
>    'China',
>    'India',
>    'Malaysia',
>    'NewZealand',
>    'Philippines',
>    'South Africa',
>    'Taiwan',
>    'Vietnam',
>  ],
>  North => [
>    'U.S.',
>    'Canada',
>    'Mexico',
>  ],
> 
>  South => [
>    'Argentina',
>    'Brazil',
>    'Venezuela',
>  ],
> );
> 
> 
>  foreach my $countries ( keys %Regions ) {
>      print "$countries: @{ $Regions{$countries} }\n"
>  }

It looks like you have already done that. For instance, to print all European
countries you can write:

  my $region = 'Europe';
  print "$_\n" foreach @{$Regions{$region}};

HTH,

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to