I would agree, except that rearranging subroutines and variable declarations in some automated way seems to be a more difficult (and potentially buggier) task. --Chris On Wed, 16 Aug 2000, Douglas Wilson wrote: > > That gives me a 'Variable "$counter" may be unavailable at ./tst2 line 17.' > warning. And its sort of obfuscated (to me, anyway). I'd probably do it this > way: > > #!/usr/local/bin/perl -w > > use strict; > > #!/usr/bin/perl -w > use strict; > > for (1..3){ > print "run: [time $_]\n"; > run(); > } > > { > my $counter; > > sub run { > $counter = 0; > > print $counter,"\n"; > > increment_counter(); > increment_counter(); > > } > sub increment_counter { > $counter++; > print "Counter is equal to $counter !\n"; > } > } >
- Re: RFC: Apache::Reload Matt Sergeant
- Re: RFC: Apache::Reload Ken Williams
- Re: RFC: Apache::Reload Leslie Mikesell
- Re: RFC: Apache::Reload Matt Sergeant
- Re: RFC: Apache::Reload Michael Robinton
- Re: RFC: Apache::Reload Ask Bjoern Hansen
- Re: RFC: Apache::Reload Matt Sergeant
- getting rid of nested sub lexical problem chris
- RE: getting rid of nested sub lexical prob... Douglas Wilson
- Re: getting rid of nested sub lexical ... Randal L. Schwartz
- Re: getting rid of nested sub lexical ... chris
- Re: getting rid of nested sub lexical prob... Dan Campbell
- Re: getting rid of nested sub lexical prob... Chris Nokleberg
- Re: getting rid of nested sub lexical ... Doug MacEachern
- Re: getting rid of nested sub lex... Chris Nokleberg
- Re: getting rid of nested sub... Doug MacEachern
- Re: RFC: Apache::Reload Matt Sergeant
- Re: RFC: Apache::Reload Ken Williams
- Re: RFC: Apache::Reload Matt Sergeant
- Re: RFC: Apache::Reload Ken Williams