rsiedl has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings; my %blah1 = (); $blah1{condition} = ""; $blah1{terms} = [ "foobar" ]; my %blah2 = (); $blah2{condition} = "AND"; $blah2{terms} = [ "foo", "OR bar" ]; my %tests = (); $tests{1} = %blah1; $tests{2} = %blah2; print "Results from a straight hash:\n"; &makef(%blah2); print "Results from a hash within a hash:\n"; &makef(%{$tests{2}}); sub makef { my (%farticle) = @_; foreach my $blah (@{$farticle{terms}}) { print "$blah\n"; } } exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: hash with a hash
by almut (Canon) on Jun 04, 2007 at 09:02 UTC | |
by perlfan (Parson) on Jun 04, 2007 at 19:34 UTC | |
|
Re: hash with a hash
by andreas1234567 (Vicar) on Jun 04, 2007 at 09:32 UTC | |
|
Re: hash with a hash
by nferraz (Monk) on Jun 04, 2007 at 10:02 UTC | |
|
Re: hash with a hash
by 13warrior (Acolyte) on Jun 04, 2007 at 10:53 UTC | |
|
Re: hash with a hash
by Anonymous Monk on Jun 04, 2007 at 18:43 UTC | |
|
Re: hash with a hash
by TGI (Parson) on Jun 04, 2007 at 23:18 UTC |