| 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/"
|