H’lo folks,

 

Assuming I have a hash ref $foo passed to TT2 as foo, why would foo.size return undef? And foo is not empty… I foreach through it immediately after... Any scalar returns a 1, which I understand is because scalars are cast as lists for list virtual methods.

 

I originally ran into this issue while trying to find a reasonably intelligent way to deal with nested hashes with foreach(es)… some of the values are scalar and need to be dealt with as such, but I’m really looking for a way to test if the value is a ref and handle it appropriately if it is.

 

Basically, I want the following data structure to be printed out:

$foo = {

          key => value ,

          key => value ,

          key => {

                   key => value ,

                   key => value ,

          } ,

          key => value ,

};

 

But at this point I’d settle for an explanation as to why size doesn’t seem to be behaving…

 

Thanks,

mark

Reply via email to