p6opaque

perl6 “P6opaque, Str” vs simple “Str” types

霸气de小男生 提交于 2020-01-03 08:19:09
问题 I was trying to obtain a list from user input doing my usual codes, but sometimes it fails unpredictably due to this error: This type cannot unbox to a native integer: P6opaque, Str The code line is my @a = prompt("Enter list: ").words || (1,2,3); It failed only if I enter only one number. When is a Str converted to "P6opaque, Str" without user awareness? I cannot use +@a[0] or @a[0].Int to convert this "P6opaque, Str" to an Int. What am I missing here? Thank you very much for your help !!!