# Matching start/end of line
my $str = q{foo
bar
cake};
# ^^ and $$ match the line beginning/ending
say "Matched beginning of line '$/'" if $str ~~ m/^^bar/;
say "Matched end of the line '$/'" if $str ~~ m/bar$$/;
say "Matched end of the line '$/'" if $str ~~ m/cake$$/;
TODO: I need better examples of beginning/end lines.