# A list of hockey teams - lists start with "@", variables start with "$"
my @teams = qww<Jets Leafs Sharks Penguins Capitals Oilers Wild "Red Wings">;
say "Teams that start with R or P";
for @teams -> $team { say "* $team" if $team ~~ /^R||P/ };
# Example of a subroutine
sub is_canadian(@list) {
for @list -> $elem {
given $elem {
say "- $_ are Canadian"
when /Jets|Leafs|Canadien|Oilers|Flames|Canucks|Senators/
}
}
}
say "\nRun our is_canadian() subroutine with \"@teams\" as the argument ..." ;
is_canadian(@teams)