In most languages, regular expressions have symbols to indicate when the first part or last part must match the first or last part of the string or line. These are called anchors. Anchors are usually the caret (^) for matching the beginning of a string, and the dollar sign ($) for the end of the string. Hence:
'abc' =~ /c$/ => true
'abc' =~ /a$/ => false
'abc' =~ /^a/ => true
'abc' =~ /^c/ => false
I can remember what the anchors are. When I have trouble remembering which is which, I use the following mnemonic: