in reply to Confusion in naming variables in subroutines

In my opinion, it's perfectly fine to do it this way.

Although they are separate variables in memory, they contain the same values (ie. refer to the same measurements), so it makes perfect sense to name them the same.  Besides which, the names are nice and descriptive, so having them named anything else would only be potentially confusing.

The important thing is, of course, that you've correctly used my to declare the lexical versions, scoped to the subroutine.  To be even more safe, I'd recommend use strict; and use warnings; at the top of the program.


s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

Replies are listed 'Best First'.
Re^2: Confusion in naming variables in subroutines
by Anonymous Monk on Jan 24, 2007 at 01:28 UTC

    Thanks for the clarification. I forgot to add "use strict" and "use warnings" to the sample code.