Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (10)
As of 2014-08-20 15:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (118 votes), past polls