Uri Guttman wrote: >>>>>> "SB" == Steve Bertrand <st...@ibctech.ca> writes: > > SB> I make these hashes available globally, initially as undef. I have a > > there is no such thing as an undef hash. it is either empty or > not. undef is a single value and hashes are always in pairs. never do > undef %hash or even worse %hash = undef (the latter will trigger a > warning). one big reason to never undef a hash is that it leads to using > defined on hashes which is totally wrong. defined will be true if the > hash (even when empty) if it ever had any keys in it.
Ahhh, of course, thanks! > SB> Instead of copy/pasting each test for all of the known types, I'd > SB> like to iterate through a list of known type names, and then map > SB> the name of the type to the hash with the same name. I think what > SB> I want is a symbolic ref, but I can't quite figure out how to map > SB> the hash to the name. > > you want a hash of hashes. never use symrefs if you don't have to. the > rule is symrefs are for munging the symbol table, not for general > purpose data structures. the symbol table is just a specialized hash > tree anyway so it offers NO advantages over a regular hash tree but it > allows for all sorts of nasty hard to find bugs. I don't know why I didn't think about the hash of hashes for this. I also really like your suggestion of putting the hashes within a sub. This will prevent the reset of ALL the data types each time new tests are run. Thanks! Steve
smime.p7s
Description: S/MIME Cryptographic Signature