Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Scalars within Subroutines (scope)

by simeon2000 (Monk)
on Jul 19, 2002 at 15:41 UTC ( [id://183277]=note: print w/replies, xml ) Need Help??


in reply to Scalars within Subroutines (scope)

Personally, I wouldn't use $a and $b because they are the default variables to compare in sort blocks.

But as far as using the same names for variables in function1 and function2, as long as you properly scope them, there is no problem whatsoever.

Technically, if your chief concern is clobbering your variables defined earlier, as long as you use warnings (as we all do, right?) with "my" scoping, perl will give you a heads up if you DO attempt to shoot yourself in the foot in this manner:)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (7)
As of 2024-04-23 13:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found