in reply to Accessing data in scalar with hashes and arrays

If you are mixing Hash and array refs in the variable, you need to handle each separately:
use strict; use warnings; my $ref = [ [ { 'BERICHT' => 'test', 'IP' => '127.0.0.1', 'NAAM' => 't +est' }, { 'BERICHT' => 'test', 'IP' => '127.0.0.1', 'NAAM' => 'H +tbaa' } ], { 'rm' => 'start', 'dummy' => '' } ]; foreach my $outer (@$ref) { if (ref($outer) eq "HASH"){ print "<b>$outer->{rm}</b></br>\n"; }else{ print "<b>". $_->{'NAAM'} . "</b><br>\n" for @$outer; } }
Output:
<b>test</b><br> <b>Htbaa</b><br> <b>start</b></br>
Oops - looks like grep++ beat me to showing you how.

     "A closed mouth gathers no feet." --Unknown

Replies are listed 'Best First'.
Re^2: Accessing data in scalar with hashes and arrays
by Htbaa (Sexton) on Nov 25, 2006 at 22:26 UTC
    Thanks anyway :-). The first array is passed to a HTML::Template object and the hash is used for extra information that's not being used by HTML::Template.