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
In reply to Re: Variable in a foreach loop
by haukex
in thread Variable in a foreach loop
by ravi45722
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |