<snip>

The term "slurpy" did help a lot.

:-)

I am writing your explanation down for my records.


Well Golly!

$ p6 'sub printx(**@args){print(@args)}; printx("abc",1,"def\n");'
abc 1 def

$ p6 'sub printx(**@args){print @args, "\n"}; printx("abc",1,"def");'
abc 1 def

Question:
$ p6 'sub printx(**@args){print(@args)}; printx("abc","xyz","def\n");'
abc xyz def

Are the spaces suppose to be there?

In each case you are using 'print @args', then `printx` adds on a "\n" either to the last item or the final string, which in each case results in exactly the same string. The way 'print' handles an array is to put a space between each item, which can be very confusing when dealing with items that are themselves strings with spaces.

For other "stringifications" of an array, try 'print @args.fmt("%s,")' if you want a comma, or 'print @args.perl'.

I find '.say for @args' is better because I get an item on each line.

Also 'dd @args' is quite useful.

Reply via email to