How to fix: Unescaped left brace error from Perl
In 2019, a Perl update contained a change that broke some Encodable apps like FileChucker and UserBase. Installations that worked fine before would suddenly start displaying errors like this:
Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/%PREF{ <-- HERE (\w+)}/ at filechucker.cgi line 2011.
This issue is fixed in the latest version of FileChucker (and will be fixed soon in UserBase), so you may want to get the update.
Or, if you want to fix your existing installation, you can do that instead. First, make a backup copy of the script in question, e.g. filechucker.cgi or userbase.cgi. Then open the file in a text editor and go to the line number given in the error message. For example:
$PREF{after_upload_redirect_to} =~ s/%PREF{(\w+)}/$PREF{$1}/g;
The problem there is as explained in the error message: the "{" character in "%PREF{(\w+)}". The fix is to "escape" that character, by putting a backslash before it. And you'll need to escape the right brace too. The fixed line is:
$PREF{after_upload_redirect_to} =~ s/%PREF\{(\w+)\}/$PREF{$1}/g;
NOTE: you must not escape all the braces on the line. The ones before the "=~" must remain unescaped. And the ones in the second half of the regex must also remain unescaped. The regex is the "s/.../.../g" part. Notice it has a first half (near the s) and a second half (near the g) separated by a slash in the middle. You must only change the first half.
After you've fixed this line, upload your fixed file to your website, and reload the page in your browser. You should now see the same error again, but this time referencing a different line. There are about 15-20 lines like this that need to be fixed.