--- [EMAIL PROTECTED] wrote:
> what do you mean I cant? It is logically working! Is this is
> recommedation for more readibility and thats it? Or is this Perl
> best
> practice thingy?
Because Perl subroutines are not lexically scoped.
sub foo {
sub bar {
return 'bar';
}
print bar();
}
print bar();
If you really need lexically scoped subroutines, assign an anonymous
subroutine to a scalar:
sub foo {
my $bar = sub {
return 'bar';
};
print $bar->();
}
# no access to $bar from here
Cheers,
Ovid
--
If this message is a response to a question on a mailing list, please send
follow up questions to the list.
Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>