Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Numification of strings

by Jenda (Abbot)
on Aug 02, 2010 at 13:32 UTC ( [id://852469]=note: print w/replies, xml ) Need Help??


in reply to Re: Numification of strings
in thread Numification of strings

No, it will not be ' ', it will be ''. That's not the same thing.

And actually if a variable has not been assigned, then it's value is undef, which is not a string, but its stringified value is '' an numified value is 0. There is no such thing as an "undefined string" or "string variable"! It is a scalar variable whose value may be undef and/or string and/or integer and/or float and/or reference.

Jenda
Enoch was right!
Enjoy the last years of Rome.

Replies are listed 'Best First'.
Re^3: Numification of strings
by LanX (Saint) on Aug 02, 2010 at 14:00 UTC
    well always? :)

    dualvar NUM, STRING Returns a scalar that has the value NUM in a numeric contex +t and the value STRING in a string context. $foo = dualvar 10, "Hello"; $num = $foo + 2; # 12 $str = $foo . " world"; # Hello world

    Cheers Rolf

      And what does this disagree with? I never said the integer and string values of a scalar variable have to be in any way related.

      Jenda
      Enoch was right!
      Enjoy the last years of Rome.

        Well take it as clarification that there are no "string variables" but "scalar variables" with different slots.

        Perl is so magic that, easy answers are not always true...

        Cheers Rolf

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-03-29 00:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found