Re: accessing variables in subroutines

2013-06-26 Thread bill pemberton
Scope? On Wednesday, June 26, 2013, lee wrote: > Hi, > > the following example doesn't compile: > > > use strict; > use warnings; > > > sub test { > print $counter . "\n"; > } > > > my $counter = 0; > while($counter < 5) { > test(); > $counter++; > } > > > It says "Global symbol "$cou

Re: last

2013-06-17 Thread bill pemberton
I think the rest after the 'if' for the last is wrong. either do this: last if ($counter > 2); or if ( $counter > 2) { print 'if : ' . $counter . "\n"; #could do print "if : $counter\n" as well last; } On Mon, Jun 17, 2013 at 8:56 AM, lee wrote: > Hi, > > trying to figure out what