Hi,
Please have a glance on the following code and suggest me to purify it.....
My requirement is when the user choose the region,I need to display the
countries specific to that regions.
I have been trying in both hash and array references.This one is for
arrayref.
I have already the values of $RegionStmt in an individual array...
I hope that we can use the following statement to retrive the first value of
the first array ref. $countryValues= $Regions[0][0];
I would like to retrive all the values instead of single one.....Please
suggest me.
Thanks .
#Start
#! /usr/local/perl/bin
use strict;
my @Regions = (
["Belgium","Denmark","France","Germany","GreatBritain","Hungary","Portugal","Russia","Spain","Sweden","Turkey"
],
[ "Australia","China","India"," Malaysia"," New Zealand","
Philippines"," South Africa"," Taiwan"," Vietnam" ],
[ "U.S."," Canada"," Mexico" ],
[ "Argentina"," Brazil"," Venezuela" ],
);
foreach my $RegionStmt (@Regions) {
if ($RegionStmt =~ /Europe/)
{
$countryValues= $Regions[0];
print "countryValues: $countryValues<br>\n";
}
elsif ($RegionStmt =~ /Asia/)
{
$countryValues = $Regions[1];
}
elsif ($RegionStmt =~ /North/)
{
$countryValues = $Regions[2];
}
elsif ($RegionStmt =~ /South/)
{
$countryValues= $Regions[3];
}
}
#End of the Code