Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

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

Comment on Re: How to make bi-modal variables like $! ?
Download Code

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 lurking in the Monastery: (10)
As of 2015-11-27 08:43 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (722 votes), past polls