in reply to Perl's Bad Ideas

I can but agree on this. When I started learning perl, this was one of the things that definetely confused me. Not only is it a strange syntax to remember, but the only obvious mnemonic I could come up with - # means a number, thus "number of elements" - is also wrong. Unless you count from zero, like perl does. ;-)

To be honest, I was never to satisfied with scalar @var either, even if it is logical when you get the idea of contexts, and that arrays return the number of elements in scalar context. That was not a given...

I really would like the simple function(s) length(@array) and possibly index_of_last(@array). Possibly with OO-syntax like @array.length(), and most certainly with a better name instead of index_of_last. :) But maybe I am a bit unortodox here, about perl... well, could I have those alternatives as well as something short?

And not to mention that lots of text editor's syntax coloring croak badly on $#var making the rest of the line a comment...


You have moved into a dark place.
It is pitch black. You are likely to be eaten by a grue.