in reply to Re^2: Opinion: where Perl5 wasn't attractive for me
in thread Opinion: where Perl5 wasn't attractive for me
Yeah, bad idea.
Consider the two proposed automatic mys in the following code. It avoids an obvious compile time fault ($line), while causing a silent run time fault ($indux).
use strict; use warnings; my $index = 0; while ($line = <>) { frobnicate($indux++, $line); }
Appended Re: LanX's comment
If only applying the my to assignments initializations, then consider this code with the same issues:
use strict; use warnings; my $faultsInARow = 0; while ($line = <>) { if (frobnicate($line)) { $faultsInaRow = 0; #Initializing a new variable by mistake. }else{ $faultsInARow ++; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Opinion: where Perl5 wasn't attractive for me
by LanX (Saint) on Nov 19, 2014 at 16:58 UTC | |
by SuicideJunkie (Vicar) on Nov 19, 2014 at 18:57 UTC | |
by LanX (Saint) on Nov 19, 2014 at 20:29 UTC | |
by SuicideJunkie (Vicar) on Nov 19, 2014 at 20:43 UTC | |
by Jenda (Abbot) on Nov 20, 2014 at 16:11 UTC | |
|
Re^4: Opinion: where Perl5 wasn't attractive for me
by LanX (Saint) on Nov 19, 2014 at 16:12 UTC |