Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Variable in a foreach loop

by haukex (Archbishop)
on Jul 14, 2016 at 10:50 UTC ( [id://1167770]=note: print w/replies, xml ) Need Help??


in reply to Variable in a foreach loop

Hi ravi45722,

A recent post of mine should answer your question: Re: Default variable $_ is not getting overwritten. In short, this is the intended behavior, have a look at the implicit localization of variables in a foreach described here.

Hope this helps,
-- Hauke D

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (7)
As of 2024-04-16 07:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found