in reply to eval() and INIT{}
Try running with warnings enabled:
$ perl -wle 'eval " print 1; INIT { print 2 } END { print 3 } BEGIN { print 4 } CHECK { print 5 } "' Too late to run INIT block at (eval 1) line 3. 4 Too late to run CHECK block at (eval 1) line 6. 1 3
What happens is that "string eval" code is compiled after the run-time has been initialised, therefore it's too late for INIT/CHECK mechanism.
|
|---|