I have worked on some Perl data mining libraries. Libraries are full of nested loops for collecting and processing information. I work with strict mode, and I always declare my variables from myoutside the first loop. For example:
my $flag = 1;
my ($v1, $v2);
while ($flag) {
for $v1 (1 .. 1000) {
$v2 = $v1 * 2;
}
}
For what I read here , in terms of efficiency, it is better to declare them outside the loop, however, maintenance of my code is becoming more and more as the declaration of some variables ends quite far from where they are actually used.
Something like this would be easier to accomplish:
my $flag = 1;
while ($flag) {
for my $v1 (1 .. 1000) {
my $v2 = $v1 * 2;
}
}
Perl, ++. - , , Perl, .
Perl- ?