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 "$counter" requires explicit package name ...".
When I put the subroutine after the 'while' loop, it works just fine, so
what's the problem?
--
"Object-oriented programming languages aren't completely convinced that
you should be allowed to do anything with functions."
http://www.joelonsoftware.com/items/2006/08/01.html
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/