my $line = ";\n"; print $line =~ /$_/ ? "" : "no ", "match: $_\n" for '^;$', '^;', "^;\\z"; #### match: ^;$ match: ^; no match: ^;\z