You're trying to dynamically generate code.
perl -e'... if ($xyz) { print "my \$globalbar;\n"; } ...' | perl
yuck.
which obviously doesn't work as $globalvar will only be local to the it's subroutine.
No, its scope is limited to block (curlies) it's in.
In reply to Re: how do i create a global var conditionally?
by ikegami
in thread how do i create a global var conditionally?
by perltux
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |