Hi All,

I am confused.

This line will convert a string into an integer, but
will print out and extra line with "(Int)" on it:

   $ p6 'my Str $x = "5"; my Int $y = dd +$x; say $y'
   5
   (Int)


This will convert as well, but no extra line:

   $ p6 'my Int $x; my Str $y = "5"; $x = "$y" + 0; say $x'
   5


Also, I can quote $x, and it still works:

   $ p6 'my Int $x; my Str $y = "5"; $x = "$y" + 0; say "$x"'
   5


But this tells me I have an uninitialized value, when all
I did was add quotes around $y, as in the above line.

   $ p6 'my Str $x = "5"; my Int $y = dd +$x; say "$y";'
   5
   Use of uninitialized value $y of type Int in string context.
   Methods .^name, .perl, .gist, or .say can be used to stringify
   it to something meaningful.


Why would I want to use "dd"?

Many thanks,
-T

Reply via email to