"dd" is a built in Data::Dumper, in Perl 5 terms, not a conversion routine. I wanted it to show clearly the types, but it's not as clear as it might have been because I was dumping expressions instead of variables (where it would have shown name and type as well).
On Tue, Aug 7, 2018 at 3:03 AM ToddAndMargo <toddandma...@zoho.com> wrote: > >> 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 > -- brandon s allbery kf8nh allber...@gmail.com