in reply to Re: Improve my Code: Subroutines
in thread Improve my Code: Subroutines
sub f { my ($arg1, $arg2) = @_; ... }
or
sub f { my $arg1 = shift; my $arg2 = shift; ... }
Using $_[0] is rarer.
Also, C style for loops are generally ugly and unperlish
True, but none of your alternatives are particularly better. I would move the my into the loop, though.
for (my $i=1; $i<=100; $i+=2) { # 1, 3, 5, ..., 99
|
|---|