Re: Assigning a variable to hash keys and values

From: John W. Krahn (krahnj_at_acm.org)
Date: 06/29/04


To: beginners@perl.org
Date: Tue, 29 Jun 2004 01:01:40 -0700

Daniel Falkenberg wrote:
>
> Hello All,

Hello,

> I currently have a hash of a hash...
>
> > %HoH = (
> > Key1 => {
> > Apple => "Green",
> > Banna => "Yellow",
> > },
> > Key2 => {
> > Carrot => "Orange",
> > Tomoatoe => "Red",
> > },
> > );
>
> How can I assign Key2 to a variable?

my $variable = $HoH{ Key2 };

John

-- 
use Perl;
program
fulfillment


Relevant Pages