Try this:

@[EMAIL PROTECTED]'EST'}};
print $info[3];

regards,
jimbob
__________________________________________________


-----Original Message-----
From: n[ate]vw [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 08, 2006 1:12 PM
To: beginners@perl.org
Subject: Trouble simplifying hash of array access

I'm having some trouble using a hash of arrays. I thought I was starting

to understand the jumbled mass of variable use in Perl, but perhaps
not...

Instead of the missing switch() statement, I'm using a hash set up like 
this:

%zone_info = (
  'EST'  => [5,'EST', 4,'EDT'],
  'EST5' => [5,'EST-'],
  'CST'  => [6,'CST', 5,'CDT'],
  'MST'  => [7,'MST', 6,'MDT'],
  'MST6' => [6,'MST-'],
  'PST'  => [8,'PST', 7,'PDT'],
  'AKST' => [9,'AKST',8,'AKDT'],
  'AST'  => [4,'AST'],
  'HST'  => [10,'HST']
);

I can get values from deep inside it's bowels by a statement like:
  print $zone_info{'EST'}[3];

That gets repetitive, so I'd like to simplify it this way:
  @[EMAIL PROTECTED]'EST'};
  print $info[3];

...but that doesn't work! Nothing prints. What am I doing wrong?



thanks much,
-natevw

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


Reply via email to