I need to alter my Perl cgi compile/runtime variables according to 1st-contact by client using href link. eg, http://fred.com/cgibin/script.cgi?id=ABCUsing params value I want Perl to get variables from file ABC.rc so that scripts code will process according to environment needed by user id ABC. Not able to understand use/require/Camel-page285. NO code needed, just pre-sets for variables used in script. I am using 'use strict;' and '-w Perl switch' Help greatly appreciated - mind is totally blasted away by this and can't get to 1st base with the mechanics/syntax!!! Thanks Timal

Thank you for such multi-faceted reply!! Have no problem with getting param/vals into cgi... but your tip on /foo.cgi?username was indeed interesting and I'll use it! However I think is problem with compile/run time Perl processing regards what is in scope at this time since only one of the following (using eval() ) actually got part-way to what I want: ------------------------------------------- FILE: testrc1 CONTENTS: #!... -w use strict; my $UID = $ARGV[0]; require "$UID.rc"; print "$a,$b,$c\n"; exit(0); ---------- FILE: abc1.rc CONTENTS: my $a = 1; my $b = 2; my $c = 3; 1; =========== RUN-IT: $ testrc1 abc1 RESULTS: Global symbol "$c" requires explicit package name at ./testrc1 line 5 COMMENT: Ok, seems asif scope in require'd file: abc1.rc deemed local to file and no explicit import of $a,$b,$c into main:: I am probably way off here, but above code is what I'd like to have ;-) IE, main:: code uses variables which it does not know about values UNTIL process-in the username.rc file which 'somehow' loads values into the symbol table etc... so that Perl not get upset when compile...

The problem with TESTRC1 is that your require()d file declares its variables with my(), which means they're not seen OUTSIDE that file -- not what you'd like. And in your main program, $c was never declared using my(), so strict.pm got upset. By the way, $a and $b are exempt from strict.pm's tyranny, since they're used in sort() subroutines. Variables declared via my() are not entered into the symbol table at all. Only global variables are found in the symbol table.

If you want to get the effect of require() at compile-time (I don't know exactly why that's important to you), then wrap it in a BEGIN { } block:

This will warn you that $this and $that are uninitialized. The reason is because config.pl is setting $main::this and $main::that, while main.pl is using lexically scoped variables $this and $that, not the global variables $main::this and $main::that.

config.pl is free from main.pl's 'use strict' limitation because the code is executed in a NEW scope, not within main.pl's scope, and strict.pm's effects are scope-based. The variables we define in config.pl are in main::. Then, in main.pl, we tell strict.pm to allow $this and $that without having to give an explicit package name. The vars.pm pragma basically tells Perl that these symbol names are to be assumed to be in the package you're in, so saying: