This is not an answer to your question, but rather a related observation. Here's the relevant section of the docs for do (my emphasis):
It may not be not entirely obvious, but the underlined sentence implies that, despite the similarity of the two constructs, with do 'stat.pl' strictures are not enforced, but they are with eval `cat stat.pl`.
In the following example, the file x.pl contains only the line $x = 1;
# y.pl
use strict;
use warnings;
use diagnostics;
do 'x.pl';
print 'do: ', +( $@ ? $@ : 'ok' ), "\n";
eval `cat x.pl`;
print 'eval: ', +( $@ ? $@ : 'ok' ), "\n";
__END__
do: ok
Variable "$x" is not imported at (eval 2) line 1 (#1)
(F) While "use strict" in effect, you referred to a global variabl
+e that
you apparently thought was imported from another module, because
something else of the same name (usually a subroutine) is exported
+ by
that module. It usually means you put the wrong funny character o
+n the
front of your variable.
eval: Global symbol "$x" requires explicit package name at (eval 2) li
+ne 1.
So you'll need to use eval instead of do if you want strictures, but you'll have to check $@ yourself after the eval.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|