On Sunday, May 5, 2002, at 03:07 , Jonathan E. Paton wrote:
[..]
> print join (" ", @hash{qw<key1 key2>});
sick, but it works....
> Appears the array symbol is required, and probably the above would need to
> be changed to:
>
> print join (" : ", @{%$_}->{qw<dir tpl ext rgx>}) . "\n" for @$cfgs;
One Clump over the line - needed to be:
print join (" : ", @{$_}{qw<dir tpl ext rgx>}) . "\n" for @$cfgs;
since:
$cfgs = $tplCfg{'category1'}{'cat1type1'};
pulls out
[
{
dir => "cat1type1dir1",
tpl => "cat1type1tpl1",
ext => "cat1type1ext1",
rgx => "cat1type1rgx1",
},
],
which is an array of hashes - hence $_ is itself a reference
to the autonomous hash....
hence since we are playing the
@hash{@keys_oh_hash};
game we don't want to get that confused with the "->" component....
http://www.wetware.com/drieux/CS/lang/Perl/Beginners/BenchMarks/complexArrayHash_v_loop.
txt
for the details on the comparison....
looks like the double loop is faster.... but it may not be
in some other configuration of data...
ciao
drieux
---
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]