Re: I need hash string help

2019-01-11 Thread ToddAndMargo via perl6-users
On 1/11/19 6:51 PM, ToddAndMargo via perl6-users wrote: On 1/11/19 6:49 PM, Brad Gilbert wrote: $a is short for $a{'a','b'} This also happens in string literals my $a = { a => 1, b => 2 }; say "$a"; # 1 2 say "$a{'a','b'}"; # 1 2 A simple way to stop this is to add a backslash

Re: I need hash string help

2019-01-11 Thread ToddAndMargo via perl6-users
On 1/11/19 6:49 PM, Brad Gilbert wrote: $a is short for $a{'a','b'} This also happens in string literals my $a = { a => 1, b => 2 }; say "$a"; # 1 2 say "$a{'a','b'}"; # 1 2 A simple way to stop this is to add a backslash my $a = 'b' say "$a\"; # b You can also call

Re: I need hash string help

2019-01-11 Thread ToddAndMargo via perl6-users
On 1/11/19 6:35 PM, Bruce Gray wrote: On Jan 11, 2019, at 7:08 PM, ToddAndMargo via perl6-users wrote: 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;

Re: I need hash string help

2019-01-11 Thread Brad Gilbert
$a is short for $a{'a','b'} This also happens in string literals my $a = { a => 1, b => 2 }; say "$a"; # 1 2 say "$a{'a','b'}"; # 1 2 A simple way to stop this is to add a backslash my $a = 'b' say "$a\"; # b You can also call methods on variables in string literals, as

Re: I need hash string help

2019-01-11 Thread ToddAndMargo via perl6-users
On 1/11/19 6:23 PM, Tom Browder wrote: On Fri, Jan 11, 2019 at 20:15 ToddAndMargo via perl6-users mailto:perl6-users@perl.org>> wrote: ... > $p6 'my $x = "acme"; my %Vendors = ( acme => { ContactName => "Larry", > AccountNo => 1234 } ); my Str $y = %Vendors{$x}.Str; say $y;' In my

Re: I need hash string help

2019-01-11 Thread Bruce Gray
> On Jan 11, 2019, at 7:08 PM, ToddAndMargo via perl6-users > wrote: > > 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; say $y;' > $ p6 'my

Re: I need hash string help

2019-01-11 Thread Tom Browder
On Fri, Jan 11, 2019 at 20:15 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: ... > $p6 'my $x = "acme"; my %Vendors = ( acme => { ContactName => "Larry", > AccountNo => 1234 } ); my Str $y = %Vendors{$x}.Str; say $y;' In my experience, it helps often to avoid using strict typing

Re: I need hash string help

2019-01-11 Thread ToddAndMargo via perl6-users
On 1/11/19 5:59 PM, Tom Browder wrote: On Fri, Jan 11, 2019 at 19:09 ToddAndMargo via perl6-users mailto:perl6-users@perl.org>> wrote: 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 =>

Re: I need hash string help

2019-01-11 Thread ToddAndMargo via perl6-users
On 1/11/19 5:08 PM, ToddAndMargo via perl6-users wrote: 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; say $y;' Type check failed in assignment to $y;

Re: I need hash string help

2019-01-11 Thread Tom Browder
On Fri, Jan 11, 2019 at 19:09 ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > 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" ); Try eliminating “acme =>” for a

I need hash string help

2019-01-11 Thread ToddAndMargo via perl6-users
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; say $y;' Type check failed in assignment to $y; expected Str but got Any (Any) in block at -e line 1 $