chromatic writes that he wants to have something similar to 'use constant', but which also lets you get the name of the constant - not just its value. He goes on to discuss the implementation: > > My solution is to overload constant::import, stashing away the names > and values, so they can be fetched at runtime.
I usually use dualvar from Scalar::Util for this. dualvar gives you magic scalars that behave similarly to $!. dualvar NUM, STRING Returns a scalar that has the value NUM in a numeric context and the value STRING in a string context. $foo = dualvar 10, "Hello"; $num = $foo + 2; # 12 $str = $foo . " world"; # Hello world -- Matthew Sachs <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> http://www.zevils.com/ * GPG key: 0x600A0342 * PGP key: 0x93EA1151 #The original nonstandard deviant# (((T^E)%(PQ))^D)%(PQ) = RSA-NOP