I have a Perl script and editor I'm using is Sublime.
After the below line of code, the syntax highlighter breaks.
my $new = ($old =~ s/cat/dog/r);
This is because of /r
. But why?
How to tackle this problem or any alternatives?
This is a problem that exists in your version, v3.1.1 aka build 3176.
This was fixed in v3.2 aka build 3200.
Upgrading to the latest v3.x (v3.2.2) is covered under your current license, if you have one.
However, I strongly recommend updating to the latest version of Sublime Text 4, which is Build 4143. I use the dev builds, which are slightly ahead of the public builds, and your code is highlighted correctly there as well:
The code looks the same in Build 4143.
If you're a licensed user of Sublime Text you'll need a new license for ST4, but there are so many new features and improvements over the old version that it's definitely worth it to support the developers.