Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Writing Modules

by armstd (Friar)
on Aug 23, 2011 at 06:03 UTC ( #921830=note: print w/ replies, xml ) Need Help??


in reply to Writing Modules

^^ What Dave said, plus the added problem that you lexically (in this case file) scoped $thing with my. You'll want to use 'our' to accomplish what you're trying to do there, which is accessing it from code in a different file. 'our' will allow you to do that, my will not. Both will pass strict. I normally recommend my'ing everything possible, and use methods to access it. Then you're really in control, but slower.

my $thing = "thing";

Changes to:

our $thing = "thing";

--Dave


Comment on Re: Writing Modules
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2015-07-04 00:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls