perl -MyX my-document.lyx
####
perl my-document.lyx
####
#LyX 2.1 created this file. For more info see http://www.lyx.org/
\lyxformat 474
\begin_document
\begin_header
\textclass article
\begin_preamble
%ignore; use yX;
...
####
Number found where operator expected at test.lyx line 2, near "lyxformat 474"
(Do you need to predeclare lyxformat?)
Backslash found where operator expected at test.lyx line 3, near "\"
(Missing semicolon on previous line?)
Backslash found where operator expected at test.lyx line 4, near "begin_document
\"
(Missing semicolon on previous line?)
Backslash found where operator expected at test.lyx line 5, near "begin_header
\"
(Missing semicolon on previous line?)
Operator or semicolon missing before %ignore at test.lyx line 7.
Ambiguous use of % resolved as operator % at test.lyx line 7.
syntax error at test.lyx line 2, near "lyxformat 474"
BEGIN not safe after errors--compilation aborted at test.lyx line 7.
####
#!perl -MyX
####
#!perl -d:MyX