Please prepend 'exit;', eval the string, then check $@ for errors. exit() prevents syntactically correct perl from being executed.
use feature ":5.14"; use warnings FATAL => qw(all); use strict; use Data::Dump qw(dump pp); my $i = 'exit(); say "Hello" op'; eval $i; say $@;
Produces
Bareword found where operator expected at (eval 1) line 1, near ""Hello" op"
In reply to Re: How to do perl -c inside perl?
by philiprbrenan
in thread How to do perl -c inside perl?
by rockyb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |