in reply to How to make bi-modal variables like $! ?

Some things must have changed over the last few years... but now we have Scalar::Util, which includes the function dualvar:
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