develooper Front page | perl.beginners | Postings from June 2011

Re: Using $variable outside a foreach loop

Thread Previous
From:
sono-io
Date:
June 3, 2011 08:56
Subject:
Re: Using $variable outside a foreach loop
Message ID:
B0168011-2B12-4610-A332-3FFC4C4BACAC@fannullone.us
On Jun 3, 2011, at 8:45 AM, Alan Haggai Alavi wrote:

> Here, the scope of $name is limited to the foreach loop and not outside it. 
> So, you will have to declare the variable again for use outside the loop.

	But wouldn't that make the second "$name" a different variable?  I'm not at my computer to try it.

Marc
Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About