[Israel.pm] why does the array behave cyclic?
Sagiv Barhoom
sagivba at 012.net.il
Sat Jul 1 18:39:05 EEST 2006
hi Shlomi
On Saturday 1/7/2006 17:58, you wrote:
> Hi Sagiv!
>
> Just a note - I find your code relatively hard to follow. You might
> consider improving your style by using "paragraphs" - short sections of
> code that are separated by newlines. Also you only have a one whitespace
> indentation. And you really should use Test::More or whatever instead of
> simple prints if you want to test your code. Now for some comments:
I know, usualy I dont write that way - I only use such style on "playgroung"
code
> It is a better idea to pass the list as a reference to an array rather than
> flattened as @_.
I agree. but again I am trying to play here.
> If you have an array called @myarray, then $myarray[-1] will return the
> last element, and -2 will return the second to last element, etc.:
thanks I did not know that, probably because I always check the bounderies
before array reading or writing
>
> http://www.shlomifish.org/Vipe/lecture/Perl/Newbies/lecture1/arrays/negativ
>e_indexes.html
greate :-)
Regards Sagiv
More information about the Perl
mailing list