Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: How to make bi-modal variables like $! ?

by bart (Canon)
on Apr 22, 2005 at 07:27 UTC ( #450293=note: print w/replies, xml ) Need Help??

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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://450293]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2016-10-26 12:27 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (340 votes). Check out past polls.