in reply to "perl -c" an array of code in a running program

You could try to actually run perl -c on your code: my @results = map { system "echo '$_' | perl -c " } @code;. You have to escape your strings correctly though.

Or an eval may do the trick as well: my @results = map { eval "sub { $_ }"; $@ } @code; where adding a sub block prevents the code from actually being run.

In both those exemple you might still have code that is run, in a BEGIN block for example.