develooper Front page | perl.perl6.users | Postings from January 2019

I need hash string help

Thread Next
From:
ToddAndMargo via perl6-users
Date:
January 12, 2019 01:09
Subject:
I need hash string help
Message ID:
a62a36a5-301e-cc27-b258-0c7b358b1596@zoho.com
Hi All,

Now what am I doing wrong?  I need to convert the value in a
hash to a string:

$ p6 'my $x = "acme"; my Str $y; my %Vendors = ( acme => ContactName => 
"Larry" ); $y= %Vendors<ContactName>; say $y;'
Type check failed in assignment to $y; expected Str but got Any (Any)
   in block <unit> at -e line 1


$ p6 'my $x = "acme"; my Str $y; my %Vendors = ( acme => ContactName => 
"Larry" ); $y= %Vendors<ContactName>.Str; say $y;'
Use of uninitialized value of type Any 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


Many thanks,
-T

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About