[ABE.pm] Curious

Jeff Horwitz jeff at smashing.org
Mon Dec 18 11:02:46 PST 2006


when you assign its value to $date, you're calling "keys %$dataHRef" in a 
scalar context.  this returns the number of keys in the hash, which in 
this case is 1.

-jeff

On Mon, 18 Dec 2006, Faber J. Fedor wrote:

> I'm debugging some code.  I've got a hash that looks like this:
>
>  DB<10> x $dataHRef
> 0  HASH(0x870fa08)
>   19890131 => HASH(0x87e699c)
>      1 => 0.311103
>      10 => 0.628309
>      2 => '-0.412132'
>      3 => 0.376397
>      4 => '-0.020074'
>      5 => 0.700074
>      6 => '-0.172132'
>      7 => '-0.652206'
>      8 => '-0.673162'
>      9 => '-1.566985'
>
> I did this
>
>  DB<11> x keys %$dataHRef
> 0  19890131
>
> which is what I expected.  So in my code I say
>
> 249:        my $date = keys %$dataHRef;
>
> but
>
>  DB<12> x $date
> 0  1
>
>
> What?!
>
> -- 
>
> Regards,
>
> Faber Fedor
> President
> Linux New Jersey, Inc.
> 908-320-0357
> 800-706-0701
>
> http://www.linuxnj.com
>
>
>
> _______________________________________________
> ABE-pm mailing list
> ABE-pm at pm.org
> http://mail.pm.org/mailman/listinfo/abe-pm
>


More information about the ABE-pm mailing list