Re: scalar(%hash) gives zero

2000-05-22 Thread Doug MacEachern

On Mon, 22 May 2000, Kenneth Lee wrote:

> My script has these lines in it,
> 
>   my %in; CGI::ReadParse(\%in);
>   print scalar(%in);
>   print %in;
> 
> Then I run it under shell,
> 
>   bash$ ./myscript.pl foo=1 bar=2
> 
> It gives me 
> 
>   0foo1bar2
> 
> Can anyone explain why the "0" but not the bucket usage?

because %in is a tied hash (tied by ReadParse), nothing is ever stored
inside that hash, the tied methods use the object which is tied to it to
get/set data.  so, there is no 'bucket usage', same as:
% perl -e 'print scalar %hash'
0





scalar(%hash) gives zero

2000-05-21 Thread Kenneth Lee

My script has these lines in it,

  my %in; CGI::ReadParse(\%in);
  print scalar(%in);
  print %in;

Then I run it under shell,

  bash$ ./myscript.pl foo=1 bar=2

It gives me 

  0foo1bar2

Can anyone explain why the "0" but not the bucket usage?

Kenneth

PS. I'm using 5.6.0 with mod_perl/1.22