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

Re: Using $variable outside a foreach loop

Thread Previous | Thread Next
From:
sono-io
Date:
June 3, 2011 10:08
Subject:
Re: Using $variable outside a foreach loop
Message ID:
AB7E1FF1-6DE9-4520-A260-6ECAEE65F222@fannullone.us
C.DeRykus wrote:

> One option is an outer enclosing block that'll extend the scope of $name to that entire block:

Jim Gibson wrote:

> Declare the variable just before the loop, and remove the 'my' from the foreach statement:


	Thanks for the responses.  I was able to get it to work.

Marc
Thread Previous | Thread Next


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