in reply to coding rules
# 5. Variables local to a subroutine prefixed by some # consistent prefix such as 'this_' or 'local_'. This way # there never will be any confusion as to whether a # given variable sprang into life in the subroutine # of if it exists in the outside world and might possibly # get clobbered locally.
For this reason, the outside world variables are usually marked. Besides, global variables are bad design, object variables are prefixed with $self in Perl, and constants are usually ALL_CAPS.
IMHO the variables inside subs should not be prefixed by anything - it's the globals that should.
|
|---|