in reply to Accessing data in scalar with hashes and arrays
Output: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; } }
Oops - looks like grep++ beat me to showing you how.<b>test</b><br> <b>Htbaa</b><br> <b>start</b></br>
"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 |