![]() |
|
We don't bite newbies here... much | |
PerlMonks |
Sharing a variable between (>=) 2 filesby dichtfux (Sexton) |
on Nov 30, 2007 at 22:22 UTC ( [id://654223]=perlquestion: print w/replies, xml ) | Need Help?? |
dichtfux has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
I'm currently stuck at a very simple problem it seems, but I don't get it done. Maybe I'm just confused atm, I don't know. But enough talk, here's the problem: I'm trying to share a variable %default_settings (a dictionary or assoc array to be precise) between 2 perl files. The file that is executed by the user is called 'app.pl', the other file is called 'settings.pl'. I do 'use strict' in my code and I'd like to continue doing so. I'm using perl 5.8.8 on Linux, btw. Here's the files (relevant sections):
That's it. It seems that require in Perl isn't equivalent to #include in C. In C, this works (and is what I want to do):
My problem is related to namespaces if I'm not mistaken. I searched a bit and a thread on another forum suggested to use 'our'. That's what I do in the code as you can see, but I obvisously managed to mess it up anyways. Ideas? Thanks in advance and 'Hello' to everyone around! (This is my first post here) - dichtfux
Back to
Seekers of Perl Wisdom
|
|