in reply to Variables in a single file

Well, what is your code? Is it a script only? Then here's one example..
#!/usr/bin/perl use strict; use vars qw/$NAME $AGE $DATE/; $NAME = 'jim'; $AGE = 29; $DATE = `date`;

In that example, the variables reside in namespace main::, so that from anywhere in the program, $main::AGE will hit 29 in this example.

If this were a module..

package Sunflower; use strict; use vars qw/$NAME $AGE $DATE/; $NAME = 'jim'; $AGE = 29; $DATE = `date`;

Then from anywhere in the code (there are some variations), you can access $Sunflower::AGE.

(You do have to realize that if you code a module (pm), then that example there, those values are set at compile time, before your code calling 'use Sunflower;' runs.. Worry about this later.)

I would say if you expect your values to change from time to time.. How about a YAML config file?

#!/usr/bin/perl use strict; use YAML; my $abs_conf = '/etc/sunflower.conf'; my $config_data = YAML::LoadFile($abs_conf); printf "Age is %s, name is %s, date is %s\n", $config_data->{AGE}, $config_data->{NAME}, `date`;

And in your /etc/sunflower.conf..

---
AGE: 29
NAME: jim