The Perl syntax highlighter does not understand the Perl non-destructive search-and-replace modifier (trailing /r), which is described here:
You can add this line to any Perl script, and everything after it will lose proper highlighting:
my $test =~ s/.*/$1/r;
If you remove the trailing /r qualifier, the highlight corrects itself.