in reply to Re: Counting Elements output from Data::Dumper
in thread Counting Elements output from Data::Dumper

my $length=scalar @$config; print $length;

Returns an Invalid Server Error

my $length=scalar %$config; print $length;

Returns 1/8, I'm really not sure what that refers to, can you give me some more enlightenment?


--
paul

Replies are listed 'Best First'.
Re: Re: Re: Counting Elements output from Data::Dumper
by robartes (Priest) on Nov 09, 2002 at 19:01 UTC
    Hi,

    the reason you get an error on scalar @$config is that I goofed :). I missed a level in the data structure referenced to by $config: it's actually a HoAoH (hash of arrays of hashes). So, to get the length of LOGENTRY, you need to access the value of the LOGENTRY key in the hash referenced by $config, and all that in scalar context. In other words: do what LTjake said :).

    print scalar %$config This is funny - what's happening here is that you're accessing a hash in scalar context ($config is a hash reference, so %$config is a hash. scalar puts it in scalar context.). This gives you the bucket efficiency of the hash, which is pretty useless in your case.

    Sorry for the goof-up.

    CU
    Robartes-