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