Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^3: Modifying/Accessing hash in separate script

by jeffa (Bishop)
on Jul 22, 2015 at 19:31 UTC ( [id://1135902]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Modifying/Accessing hash in separate script
in thread Modifying/Accessing hash in separate script

You should be able to scope that global with our

our %GLOBAL = { dir1 => "/path/to/directory" dir2 => "/path/to/another" };
You will most likely have more errors to contend with that are not necessarily related. Just deal with them one at a time. (And check in your code each time you successfully remove a compilation error or warning.)

UPDATE!
Why is that hash holding a hash reference? It probably should be either

our %GLOBAL = ( dir1 => "/path/to/directory" dir2 => "/path/to/another" );
or
our $GLOBAL = { dir1 => "/path/to/directory" dir2 => "/path/to/another" };
I sincerely hope that was a typo on your behalf, this looks to be a daunting piece of code to refactor.

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re^4: Modifying/Accessing hash in separate script
by mdskrzypczyk (Novice) on Jul 22, 2015 at 19:48 UTC
    You're right, the hash syntax was a typo and I'm sorry if that threw you off. Yes it has proven to be quite the task especially since I was thrown at it with absolutely no perl knowledge prior looking at the code. I really appreciate your help it means a lot to me and shows how great the perl community can really be.
Re^4: Modifying/Accessing hash in separate script
by mdskrzypczyk (Novice) on Jul 22, 2015 at 20:00 UTC
    Adding "our" before the hash declarations in my global.pl still makes the main.pl throw errors when using strict and warnings, the same error: Global symbol "%GLOBAL" requires explicit package name at line xx. Perhaps this wasn't the solution?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1135902]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2024-04-19 08:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found