you are working with two different variables.

On Feb 27, 2007, at 12:24 PM, Ravi Malghan wrote:

what am I doing wrong here when trying to access the
value john for node1
=========
$SESSION{FirstRun} = 1;

this line creates a _hash_, %SESSION with one element (keyed by FirstRun, value is 1).

%nodeowner = ("node1", "john", "node2", "nancy");
push(@SESSION, %nodeowner);

here you're pushing to an array that perl has never heard of, @SESSION, so perl goes ahead and makes an empty one for you before it pushes your hash to it. you end up with an array of one element where $SESSION[0] = %nodeowner

print "node1: $SESSION{$nodeowner{node1}}\n";

the value of $nodeowner{node1} is 'john', so here you are trying to access the %SESSION hash's key 'john', but it doesn't exist, the only key is 'FirstRun'.

sorry about saying you had the wrong syntax earlier, i thought it was. i never knew you could do hashes with the comma operator. neat. i don't think its very clear syntactically but if it works it works :-)

-neal

==========
Thanks
Ravi
--- Neal Clark <[EMAIL PROTECTED]> wrote:

ah. well in that case

@SESSION = ( \%nodeowner, \%nodeseverity );

On Feb 27, 2007, at 11:59 AM, Ravi Malghan wrote:

One correction: SESSION is just a single
dimensional
array @SESSION.

Thanks
Ravi
--- Ravi Malghan <[EMAIL PROTECTED]> wrote:

Hi: I just can't seem to figure this out.
I am trying to declare two associative array
(%nodeowner and %nodeseverity) within another
array
called %SESSION

For example
%nodeowner = ("node1", "john", "node2", "nancy");
%nodeseverity = ("node1", 5, "node2", 10);

How do I declare %SESSION containing %nodeowner
and
%nodeseverity. And how do I access say the value
John
give node1 from the nodeowner array that is in
SESSION?

TIA
Ravi






______________________________________________________________________

______________
Now that's room service!  Choose from over
150,000
hotels
in 45,000 destinations on Yahoo! Travel to find
your
fit.
http://farechase.yahoo.com/promo-generic-14795097

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









______________________________________________________________________

______________
TV dinner still cooling?
Check out "Tonight's Picks" on Yahoo! TV.
http://tv.yahoo.com/

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








______________________________________________________________________ ______________
Don't get soaked.  Take a quick peak at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather


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


Reply via email to