On Mon, Aug 6, 2018 at 4:59 PM ToddAndMargo <toddandma...@zoho.com <mailto:toddandma...@zoho.com>> wrote:

    Hi All,

    How do I assign a string that looks like an integer
    into an interger?

    $str = "601"  -- > $int = 601


    Many thanks,
    -T

On 08/06/2018 02:01 PM, Brandon Allbery wrote:
Prefix + numifies, prefix ~ stringifies.

pyanfar Z$ 6 'my Str $a = "5"; dd +$a'
5
pyanfar Z$ 6 'my Int $a = 5; dd ~$a'
"5"



What is this all about?

$ p6 'my Int $y = 7; my Str $x = dd ~$y; say $x'
"7"
(Str)

Why does it say "(Str)"?  The confirmation is nice, but
why is it printing out?


And why does this error out?

$ p6 'my Int $y = 7; my Str $x = dd ~$y; say "$x"'
"7"
Use of uninitialized value $x of type Str in string context.
Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.
  in block <unit> at -e line 1

Reply via email to