Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: runtime problem; elusive error

by ikegami (Patriarch)
on Sep 20, 2007 at 19:16 UTC ( [id://640218]=note: print w/replies, xml ) Need Help??


in reply to Re^2: runtime problem; elusive error
in thread runtime problem; elusive error

I'd like to be able to put a "numeric" or "string" in front a var to let it know what I want

You can. They are spelled "0+" and "''." respectively.

my $x = '8'; my $y = '16'; print((0+$x) | (0+$y), "\n"); # 24 print((''.$x) | (''.$y), "\n"); # 96

Update: Oops, that doesn't quite answer your question. If the variable wasn't read-only, you could do the following:

$x .= ''; # Stringify $x += 0; # Numerify

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-24 02:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found