in reply to Perl 'grammar'
You will rarely need C-style loops
for ($i = 0; $i <= $#sortedNames; $i++) {
If you need a counting loop, use the much more readable (and just as efficient)
for my $i (0..$#sortedNames) {
Or when iterating over a list or array, you can use
for my $name (@sortedNames) {
Why use reverse to prepend a string?
$toOutput = reverse $temp[0]; $toOutput .= $x; $output = reverse $toOutput;
is the same as
$output = $x . $temp[0];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl 'grammar'
by gortok (Novice) on Jan 09, 2008 at 19:50 UTC |