Obviously there may be many reasons for hangs so extra information is needed to try to narrow the debugging scope.
Syntax highlighter (lexer) is a piece of code, and just like any other piece of code it may have bugs including enter infinite loops.
Bugs may be completely internal to the lexer or due to interaction with host the application that contains it.
Some tests to do and report here are:
Make sure you still reproduce the problem with original file A.
Try changing the language into a few other languages, even though the contents mismatch, to see if this is Perl issue or a general re-lexing issue.
Start Notepad++ on empty file and switch language to Perl. Does it hang?
If empty file does not hang, switch to Perl on empty file and paste the contents of file A. Does it hang?
Make sure to page up/down through all file since most lexers only kick into action for visible lines.
If paste does cause a hang try partial paste to identify a minimal piece of code that reproduces the issue.