> I think maybe I don't understand how <<>> is used in a and how <<>> differs from a ""
<<>> is quoteword, no commas needed. You get back a list. "" create a string, you get back a single thing. my $z=<<xyz{$x}def>>; (xyz abc def) is the same as my $z=<<xyz $x def>>; (xyz abc def) > my $x = "ab"; ab > my $z=<<xyz $x def>>; (xyz ab def) > my $y = "xxy $x def"; xxy ab def > $z.WHAT (List) > $y.WHAT (Str) > my $q = ["xyz", $x, "def"]; [xyz ab def] > $q.WHAT (Array) > my $r = ("xyz", $x, "def"); (xyz ab def) > $r.WHAT (List) On Wed, Oct 4, 2017 at 2:25 PM, ToddAndMargo <toddandma...@zoho.com> wrote: > > On Wed, Oct 4, 2017 at 1:29 PM, ToddAndMargo <toddandma...@zoho.com >>> <mailto:toddandma...@zoho.com>> wrote: >>> >>> On 10/02/2017 01:18 PM, ToddAndMargo wrote: >>> >>> Hi All, >>> >>> I am writing up a keeper note on <<>> and such. This example >>> puzzles me. Why the space? >>> >>> >>> Example of <<>> (double quote and allow insertion of variables >>> into strings): >>> >>> >>> $ perl6 -e 'my $x="abc"; my $y=<<xyz{$x}def>>; say "\$x=$x >>> \$y=$y";' >>> $x=abc $y=xyz abc def >>> >>> >>> >>> Many thanks, >>> -T >>> >>> >>> >>> Hi Guys, >>> >>> I am trying to document for myself what the difference is >>> between "" and <<>>. >>> >>> Maybe I should rephrase the question. Why are these >>> two different? Why the spaces when using <<>>? >>> >>> $ perl6 -e 'my $x="abc"; my $y=<<xyz{$x}def>>; say "\$x=$x \$y=$y";' >>> $x=abc $y=xyz abc def >>> >>> $ perl6 -e 'my $x="abc"; my $y="xyz{$x}def"; say "\$x=$x \$y=$y";' >>> $x=abc $y=xyzabcdef >>> >>> >>> -T >>> >>> > > > > On 10/04/2017 11:45 AM, Andy Bach wrote: > >> Why the spaces when using <<>>? >> >> in REPL >> > my $x="abc"; my $y="xyz{$x}def"; say "\$x=$x \$y=$y" >> $x=abc $y=xyzabcdef >> > $y.WHAT >> (Str) >> > $x.WHAT >> (Str) >> > my $z=<<xyz{$x}def>>; >> (xyz abc def) >> > $z.WHAT >> (List) >> >> <<>> makes a list, the { } make a closure, so you've got 3 things in the >> list; "xyz", the value of $x ("abc"), and "def" >> > $z=<<xyz$xdef>>; >> ===SORRY!=== Error while compiling: >> Variable '$xdef' is not declared >> ------> $z=<<xyz⏏$xdef>>; >> >> > $z=<<xyz$x def>>; >> (xyz abc def) >> > > > Love that "what" command. > > I think maybe I don't understand how <<>> is used in a > and how <<>> differs from a "" > -- a Andy Bach, afb...@gmail.com 608 658-1890 cell 608 261-5738 wk