Variables declared with my are file scoped. Globals are namespace scoped. This works:
#!/usr/bin/perl use strict; use warnings; our %config; do 'config.cgi'; print keys %config, $/;
Update: Clarification, a file under do cannot see lexicals in the enclosing scope. The %config that config.cgi writes to is therefore global. When do returns, the lexical %config masks the global one which was just populated.
After Compline,
Zaxo
In reply to Re: "do" what?
by Zaxo
in thread "do" what?
by cLive ;-)
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |