This is not what you meant to do:

$ echo -e "abc\ndef\nghi" | perl6 -e 'my @y = split "\n", lines; say
@y.perl
["abc def ghi"]

the lines sub already gives you a list of lines that perl6 gets fed,
you're calling split on that array that then gets coerced to a string
(which joins the lines with spaces) and then split by newlines (of which
there are none at that point), so what you end up with in @y is just a
single entry.

So just use `my @y = lines;` instead.

HTH
  - Timo

Reply via email to