Solution: Greet a person
Here is a possible solution to the task.
my $name = prompt 'What is your name? '; say 'Hello, ', $name, '!';
🦋 You can find the source code in the file greet-a-person.raku.
Run the program and enter a name when you get the prompt:
$ raku exercises/scalar-variables/greet-a-person.raku What is your name? Inge Hello, Inge!
This program uses a scalar variable
$nameto keep a string that was entered by the user in response to the prompt. When the variable is used in the list that you pass to the
sayroutine, you get the name in a message.
There is a better way to solve this problem using string interpolation. Let us return to this problem shortly.