Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Using $_ as a temp var, especially in functions

by thelenm (Vicar)
on Oct 23, 2002 at 03:00 UTC ( [id://207270]=note: print w/replies, xml ) Need Help??


in reply to Using $_ as a temp var, especially in functions

If I need a temporary variable, I don't have a problem with declaring my $foo (but usually call it something a little more meaningful). Actually, I tend to declare most variables with my anyway, unless for some reason their scope really is global. It makes the code more modular and less likely to have unintended side effects, like modifying the global $_ that you mention.

I'd recommend just biting the bullet and typing "local" if you must use $_ as a temporary variable. That's what local is for, after all. :-)

-- Mike

--
just,my${.02}

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://207270]
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: (8)
As of 2024-04-23 13:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found