This is from a memory of a discussion I couldn't find and this is just an outline but I think it'll work and be safe (someone will surely shoot that down if it's wrong).
# Read the file. # Inject 'BEGIN { exit }' at the beginning. # Run 'perl -ce' on the text. # Catch the output (eg, IO::CaptureOutput, Capture::Tiny). # Look for "syntax OK"
As mentioned, there are a few things that might not actually be Perl that'll parse fine as Perl.
In reply to Re: Recognizing Perl in text
by Your Mother
in thread Recognizing Perl in text
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |