# Matching start/end of string my $str = q{foo bar cake}; # ^ and $ match the start/end of a *string* say "Matched start of string '$/'" if $str ~~ m/^foo/; say "Matched end of a string '$/'" if $str ~~ m/cake$/; say "Failed to match start of 'bar'" if $str !~~ m/^bar/;