On 11/2/25 4:55 PM, Joseph Brenner wrote:
ToddAndMargo wrote:
my Proc $p = run( |@args, :err, :out );
What are the values with the ":" in front of them
officially called? I take it "thingies with the
colon in front of them" does not cut it.
They're colon-pairs, though you'll also see them called "adverbs" depending on
context.
You could call them adverbs here-- they're flags that turn on different
behavior for the output.
https://docs.raku.org/routine/run
If you want to capture standard output or error instead of having
it printed directly you can use the :out or :err arguments, which
will make them available using their respective methods: Proc.out
and Proc.err.
my $proc = run 'echo', 'Raku is Great!', :out, :err;
$proc.out.slurp(:close).say; # OUTPUT: «Raku is Great!»
$proc.err.slurp(:close).say; # OUTPUT: «»
You could see a construct like that used with an argument though, in
which case it's an "adverbial pair":
https://docs.raku.org/syntax/Adverbial%20Pair
Adverbs get used a lot with regular expressions, where the syntax is different:
https://docs.raku.org/syntax/Regex%20adverbs
Thank you!