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

RE: my and local differences

by quidity (Pilgrim)
on Nov 11, 2000 at 00:20 UTC ( [id://41018]=note: print w/replies, xml ) Need Help??


in reply to my and local differences

It could be the case that the original programmer expected that $sb $eb might be changed somewhere else in the script at some point. If using the given values was critical to the subroutine then it makes sense for them to be enforced whenever the subroutine is called while letting them revert to their (possibly different) values afterwards.

If the sub calls other subs while it runs, then it is essential that local is used (in this scenario) so as to avoid broken things. If the values of these variables isn't modified anywhere else in the script though, and you have good reason to expect that they will not need to be altered at some later date, then do your best to remove the localising.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-07-23 17:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.