Course of Raku / Objects, I/O, and exceptions / Input and output / Running external programs 🆕 / Exercises

Capture the output

Problem

Use run with :out to launch echo with the three words hello world raku, capture its output into a variable, and then — instead of just printing it — count how many words the captured output contains and print that number.

Example

The program prints:

3

Solution

See the solution

Course navigation

Solution: Run a command   |   Solution: Capture the output