in reply to Naming convention for variables, subroutines, modules, etc.. and variable declaration

In addition to perlstyle, pick up a copy of Perl Best Practices. It has solid advice on naming variables, functions etc., as well as variable scoping and a host of other good ideas.

IMHO, variables should be declared where they are used, and in as small a scope as possible. I would recommend following your first example.

  • Comment on Re: Naming convention for variables, subroutines, modules, etc.. and variable declaration