Re: What is the pipe symbol doing to my array?
[email protected] (Sean McAfee) Mon, 3 Nov 2025 12:10:13 +0800
| Newsgroups | perl.perl6.users |
|---|---|
| Message-ID | <CANan03bB87hnMNTAvafN8FPqcs2R5i9YCM4FKgK=aoq9sde5DA@mail.gmail.com> |
On Mon, Nov 3, 2025 at 5:25 AM ToddAndMargo via perl6-users < [email protected]> wrote: > [0] > my @x="a","b","c","d"; > [a b c d] > > [1] > say @x > [a b c d] > Here you're passing a single argument to say, the array @x, which is stringified by calling the gist method on it. It's the same as if if you had said: say @x.gist; > [1] > say |@x > abcd > Here you're passing four arguments to say, the elements of @x. It's the same as if you had said: say 'a', 'b', 'c', 'd'; > I ask because I want to know its effect is on > my $proc = run(|@x, :err, :out) > run takes a slurpy list of arguments, as indicated by the *@args parameter in its documentation <https://docs.raku.org/routine/run>, so it doesn't matter if you explicitly flatten @x with a pipe. It'll work the same either way.