For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > January 2006 > Re: "Pseudo-hashes are deprecated" error and accessing a hash of









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: "Pseudo-hashes are deprecated" error and accessing a hash of
Ch Lamprecht

2006-01-30, 7:00 pm

ernestm@mindspring.com schrieb:
> OK, so I see that this is a Perl 5.8 change. I am getting this
> "Pseudo-hashes are deprecated" error while following the Camel Book v3
> and trying to generate a count of items in a hash of hashes thus:
>
> scalar(keys %{ $logips{$key} } )
>
> Basically I'm parsing a Web log file and am trying to keep a list of
> unique IPs that visited each page (modifying Perl Cookbook recipe 4.6)
> thus:
>
> my %logips=();
> my %logipseen=();
> foreach $snifferlog (@ARGV) {
> blah blah blah;
> push (@{ $logips{$logfile} }, $logip) unless (

------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
that's a hash of arrayrefs
> $logipseen{ $logfile }{ $logip } )++;
> }
> foreach $key (@logfiles) {
> print scalar(keys %{ $logips{$key} } );

print scalar @{ $logips{$key} };
>
> So $logips{$key} should have a hash of all the unique IPs in it, I just
> want a quick count, but I'm having trouble with the hash of hash
> syntax. Apparently the older syntax in the camel book's not good any
> more and I've fiddled aroudn with this a while and read Web tutorials
> on hashes of hashes without luck. Any help welcome!
>
> Thanks,
> Ernest
>

HTH Christoph

--

perl -e "print scalar reverse q/ed.enilno@ergn.l.hc/"
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com