Just for the record, the issue is that you use double quotes on the command
line, which will interpolate any $ variables, so raku only saw the
interpolated value, which was nothing.

On Wed, Dec 4, 2019, 12:48 William Michels via perl6-users <
perl6-us...@perl.org> wrote:

> On Wed, Dec 4, 2019 at 2:22 AM ToddAndMargo via perl6-users
> <perl6-us...@perl.org> wrote:
> >
> > Hi All,
> >
> > I am going through the examples on
> >     https://docs.perl6.org/type/Map.html
> >
> > $ p6 "my $map = Map.new('a', 1, 'b', 2); say $map{'a'}; say $map{ 'a',
> > 'b' };"
> > ===SORRY!=== Error while compiling -e
> > Malformed my
> > at -e:1
> > ------> my  = Map.new('a', 1, 'b', 2); say {'a'};
> >
> > What the heck is a 'Malformed my"?  I copied and pasted
> > from the second set of examples.
>
> I got that to work no problem--on both the command line and in the
> REPL. For the command line I just made sure that the outer quotes were
> single quotes while the inner were double quotes (on a Mac):
>
> mbook:~ homedir$ perl6 -e 'my $map = Map.new("a", 1, "b", 2); say
> $map{"a"}; say $map{ "a", "b" };'
> 1
> (1 2)
> mbook:~ homedir$ perl6
> To exit type 'exit' or '^D'
> > my $map = Map.new("a", 1, "b", 2); say $map{"a"}; say $map{ "a", "b" };
> 1
> (1 2)
> > $*VM
> moar (2019.07.1)
> >
>
> HTH, Bill.
>
>
>
> >
> > And why is the first example:
> >       %e := Map.new
> > and the second example
> >       $e = Map.new
> > ?
> >
> > Many thanks,
> > -T
>

Reply via email to