oops, i only now saw the thread you had about it. never mind, then!

On 07/08/18 15:31, Timo Paulssen wrote:
> dd is a function that outputs a value, and dd returns Nil. You're
> assigning the result of dd to $x, which resets the variable to its
> default value, which is the (Str) you see, i.e. an undefined String.
>
> Just throw out the dd, you don't need it to stringify things, only the ~
> or + prefix is necessary.
>
>
> On 07/08/18 09:01, ToddAndMargo wrote:
>> 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