in reply to Re: "use strict" and undeclared variables
in thread "use strict" and undeclared variables

What's bad/buggy about the latter? I always do that (hangover from C I guess).
I prefer not to mix declarations and usage. Also, it means I can comment the declarations...

Cheers
Chris

  • Comment on Re^2: "use strict" and undeclared variables

Replies are listed 'Best First'.
Re^3: "use strict" and undeclared variables
by polettix (Vicar) on Oct 12, 2007 at 08:49 UTC
    As a rule of thumb, you should try to restrict the scope of a variable as much as possible. The former restricts @row life to the while block, while the other goes beyond. Anyway, I wouldn't classify this neither as "bad" nor as "buggy".

    Flavio
    perl -ple'$_=reverse' <<<ti.xittelop@oivalf

    Io ho capito... ma tu che hai detto?
      Anyway, I wouldn't classify this neither as "bad" nor as "buggy"

      I personally believe "error prone" may be more appropriate. Ain't it?

      Exactly.
      I was thinking of a more complex loop, and a more complex origin of @row's content. The possibility of contamining the array through some buggy code elsewhere, etc.
      But I didn't explain that more thoroughly- and it was perceived I came accross as rude :-( Sigh.