Hi, I can think of some reasons we use $ instead of @ for array
indices (in Perl5):

  1. because we are referring to a scalar, not an array slice, and
it's misleading to use @
  2. because it's common usage and all professional code uses it
  3. because @array[0] may in some selected cases be treated as a
list, for example @array[0] = @array2 (copies first element) vs.
$array[0] = @array2 (copies number of elements)

however, aside from the extremely limited-application code example in
3. above, I was unable to come up with a practical justification for
using @.

I'm talking demonstrable reason, not any "just because it's proper"
reasons like 1 and 2 above.  I can talk their ears off telling them
it's the right thing to do, but I'd prefer to have some practical
reason.

thanks!

David


Reply via email to