in reply to Printing in a WHILE loop
instead oflength[@data_array]
There are other style-related issues, primarily dealing with localizing the scope of declared variables, and using a "c-style" "for" loop where a "perl style" would be more appropriate. Let me know if you need elaboration on either point.length (@data_array)
UPDATE: length (@data_array) will not give you expected results either . (Thanks choroba for pointing that out) ; use
instead.scalar(@data_array)
This is because length() takes a scalar. These statements are equivalent (return the same value):
So the value returned by length is the length in bytes of the size of the array.length (@data_array) == length (scalar @data_array)
What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?
-Larry Wall, 1992
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Printing in a WHILE loop
by choroba (Cardinal) on May 27, 2014 at 08:03 UTC | |
by gaseous1 (Novice) on May 27, 2014 at 15:03 UTC | |
|
Re^2: Printing in a WHILE loop
by gaseous1 (Novice) on May 27, 2014 at 05:32 UTC |