in reply to Re: The Zeroeth Principle
in thread The Zeroeth Principle

  1. This was just a rough example. I always use strict, use warnings, and declare everything.
  2. I called the function without parenthesis, because it's a trivial example. I know what it does. This was just for display purposes.
  3. In perl, I have rarely ever needed anything akin to a c-styled loop. This was for simply to promote discussion. I'm happy to see it worked! :-) Such passion!
  4. Action at a distance is not good. I never do that in my own code.
  5. I mistyped. I rarely refer to the operator by name, so I said flip-flop instead of range. Believe me, I'm very well aware of list vs. scalar vs. void contexts. :-)
  6. Yes, I know. This was more to promote discussion about a strange little variable.
  7. Most of the time, I do not need an index, and so I interate over the list directly. That is the perl way to do it, after all. When I do need an index, I'm exceedingly careful about its use, and exploit the range operator to it fullest, especially since it no longer slugs memory in the gut with large ranges. Mind you, in the before time, or when performance plays an issue, simple things like moving a complicated conditional to the initializer, and runnign the loop "backwards" was a key to efficiency.

And the "our" and "we" at the top referred to a simple commonality of brethren programmers...the universal "we" in a spirit of rememberance.

I'm quite happy this little meditation has provoked much thought, although I didn't expect a lesson on stylistics. Thanks! I was more curious as to the treatment of the $[ operator by those who have used it.

Cheers!
-v
"Perl. There is no substitute."

Replies are listed 'Best First'.
Re^3: The Zeroeth Principle
by tilly (Archbishop) on Aug 26, 2004 at 18:48 UTC
    I don't know what your usual style is. However experience indicates that the way people write "toy code" is the way that they write real code as well. Therefore I reacted to aspects of your style which I thought likely to show up in real code.

    As for the treatment of $[ by those who have used it, the wise ones don't use it any more. ;-) My understanding is that $[ was added to Perl so that a2p could use it to easily emulate awk without having to track down every potential array access.

      I hear ya. In fact, I've seen a lot of "toy" code passed off as real "production" code, so I understand your dismay. But fret not; my code is much nicer and cleaner than that. Just look at any snippit. :o)

      I wonder how much a2p is still being used? I saw one person use it the other day.

      Thanks,
      -v
      "Perl. There is no substitute."