in reply to Accessing data in scalar with hashes and arrays

This might help.
my $var = [ # this signifies an anon array [ # Here is the first element of the top anon array - it i +s also an anon array { 'BERICHT' => 'test', 'IP' => '127.0.0.1', 'NAAM' => 'test' }, { 'BERICHT' => 'test', 'IP' => '127.0.0.1', 'NAAM' => 'Htbaa' } ], # end of 1st value of the top anon array { # Here is the 2nd value of the top anon array - It's an + anon hash 'rm' => 'start', 'dummy' => '' } ]; # So to access 'rm' you need the 2nd element of the top array (aka [1] +) # Deref that with $var->[1] # The 2nd element is an anon hash. That is where you need the hash key + 'rm' (aka {rm}) # Deref that with $var->[1]->{rm} print $var->[1]->{rm}; #prints 'start'

grep
XP matters not. Look at me. Judge me by my XP, do you?

Replies are listed 'Best First'.
Re^2: Accessing data in scalar with hashes and arrays
by Htbaa (Sexton) on Nov 25, 2006 at 21:51 UTC
    Oh my god was it that simple? I never tried that because, looking at the structure it looks like it's a scalar that contains an array and 2 loose elements (rm and dummy). But now I've read your comments on the structure I get it. Never thought of it like that. Thanks a lot :-). My Perl skills went down bigtime since I've been programming PHP for a few months again and have had nothing to do with Perl. I could've known it, darn :-P. In any case, I thank you a lot! Problem solved and I know now how to use these things in Perl.