Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^6: Optimizing existing Perl code (in practise)

by RMGir (Prior)
on Aug 23, 2002 at 10:13 UTC ( #192296=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Re: Re: Optimizing existing Perl code (in practise)
in thread Optimizing existing Perl code (in practise)

Of course that the best idea is always the simplest, why not put the variable with the "big data" in global (without 'my' or 'local'), to be read by all the program? K.I.S.S. -> Kip It Simple, Stupid! :-P

Nope. That would actually make things more complicated, since now you have to remember that this subroutine affects that global. It tends to make things more fragile, and much harder to follow for maintainers.

The global has no benefits whatsoever over passing data in by reference. You can modify data via a reference just as well as you can with a global...
--
Mike

  • Comment on Re^6: Optimizing existing Perl code (in practise)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2019-06-24 19:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (99 votes). Check out past polls.

    Notices?