Hi, Yes hashes would work. I'm sure any decent perl book should cover hashes. BTW this is the perl-win32-web list for Web-related issues.
To use a hash to statically store your addresses: my $addresses = { 'Arlington' => { building => '', street => "20 Street, N.", city => "Arlington", state => "VA", zip => "22201", }, 'Atlanta' => { building => "Midtown Plaza", street => "1360 Peachtree St", city => "Atlanta", state => "GA", zip => "30309", }, 'Ballston' => { building => "", street => "4015 Wilson Boulevard", city => "Arlington", state => "VA", zip => "22203", }, }; # Or to dynamically add addresses to the hash: $addresses->{Boston}->{street} = 'bla'; #.... # To retrieve the address info: my $location = 'Arlington'; foreach my $field ('street', 'city', 'state', 'zip') { print "$field: $addresses->{$location}->{$field}\n"; } Good luck! -----Original Message----- From: Sue-fang Hsu [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 09, 2003 3:34 PM To: [EMAIL PROTECTED] Subject: Could Hashes solve the problem? Hi, I need to get 5 variables - $building, $street , $city ,$state ,$zip. I use this easy logic to get These variables, I look the perl book, I think hashes and array will have different way to do it, but I don't know how to do it. Does any body have a good suggestion? I have about 25 locations, below is a modified code: If ($location eq 'Arlington'){ $building = ""; $street = "20 Street, N."; $city = "Arlington"; $state = "VA"; $zip = "22201"; }elsif ($location eq 'Atlanta'){ $building = "Midtown Plaza"; $street = "1360 Peachtree St"; $city = "Atlanta"; $state = "GA"; $zip = "30309"; }elsif ($location eq 'Ballston'){ $building = ""; $street = "4015 Wilson Boulevard"; $city = "Arlington"; $state = "VA"; $zip = "22203"; } Thanks in advance!! Sue _________________________________________________________________ MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus _______________________________________________ Perl-Win32-Web mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Web mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs