anadem has asked for the wisdom of the Perl Monks concerning the following question:
unfortunately one of the variables is set in an "include" file which is pulled by 'require'. Can I make this work? E.g.
==== main.pl ====
use strict;
my $ReqVar;
my $LocVar;
require include_file.pl;
$LocVar = $ReqVar;
<<at this point I'd like $LocVar to be foo,
but when strict and my are used $LocVar is blank
although it IS set to foo when 'my' is omitted>>
==== end of main.pl ====
==== include_file.pl ====
$ReqVar = "foo";
1;
==== end of _include_file.pl ====
thanks for hints -- I've read APP for 'strict' and 'require' and don't know if there's actually a solution. I'm constrained by this being existing code, which works when 'strict' and 'my' are not used. (It looks like 'our' in 5.6 would do this, but we're stuck at 5.003)
Alan
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: scope / strict / my / require
by dave_the_m (Monsignor) on Jul 23, 2004 at 23:02 UTC | |
by tilly (Archbishop) on Jul 24, 2004 at 21:13 UTC | |
|
Re: scope / strict / my / require
by davido (Cardinal) on Jul 24, 2004 at 04:40 UTC | |
|
Re: scope / strict / my / require
by Fletch (Bishop) on Jul 24, 2004 at 00:37 UTC |