On Sun, 2002-05-05 at 18:47, drieux wrote:
> 
> On Sunday, May 5, 2002, at 03:07 , Jonathan E. Paton wrote:
> [..]
> > print join (" ", @hash{qw<key1 key2>});
> 
> sick, but it works....

No, this is sick:

#array interpolation uses ' ' to join
print "@hash{qw<key1 key2>}\n"; 


> 
> > 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;

Which makes this:

{
        local $" = ' : ';
        print "@{$_}{qw<dir tpl ext rgx>}\n" for @$cfgs;
}

or better yet

our @fields = qw(dir tpl ext rgx);
..
..
..
{
        local $" = ' : ';
        print "@{$_}{@fields}\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]
> 
> 
-- 
Today is Sweetmorn the 53rd day of Discord in the YOLD 3168
Or not.

Missile Address: 33:48:3.521N  84:23:34.786W


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to