in reply to Re^2: Perl scoping not logical...?
in thread Perl scoping not logical...?
Localy declared subroutines might make the code clearer if they were visualy separated from the rest of the code of the subroutine and if they were used more than once within the subroutine.
Otherwise they just confuse the flow.
If you need another variable scope, a block is enough. In Perl lexical (my) variables are block scoped, not subroutine scoped. And if you want to "name" the block, use a comment.
Subroutine prototypes are NOT subroutine types! Please read When to use Prototypes? and Far More Than Everything You've Ever Wanted to Know about Prototypes in Perl.
I understand the desire to test types of variables and subroutines at compile time, but it's not possible in Perl5. Mostly.
|
|---|