in reply to ptkdb: 'my' variable in sub retains value between calls

Don't use $b, in fact don't use single letter variable names, EVER!. Besides $a, $b being special Perl variables for use with sorting, it is totally ambiguous. It does not tell you want is supposed to be there and creates maintenance headaches.

Be polite and spell out what the variable is supposed to represent and the next time you look at this code, you will be able to quickly identify what it is supposed to do.

  • Comment on Re: ptkdb: 'my' variable in sub retains value between calls

Replies are listed 'Best First'.
Re^2: ptkdb: 'my' variable in sub retains value between calls
by JavaFan (Canon) on Aug 11, 2008 at 12:12 UTC
    Never say "never" (or "ever") in programming. Never using single letter variables would mean you wouldn't use $_. Or for that matter, $i, $j, etc.