On Fri, Dec 06, 2002 at 04:22:19PM -0500, Jeff 'japhy' Pinyan wrote:
> On Dec 6, Paul Johnson said:
> 
> >On Fri, Dec 06, 2002 at 11:58:37AM -0500, Danny Miller wrote:
> >
> >> Strictly speaking, ++$count is faster than $count++.
> >
> >Strictly speaking, perl will convert $count++ to ++$count if it can.
> 
> Strictly speaking, there is another major difference no one has mentioned
> yet (and that many people might have trouble understanding).  Using
> $count++ returns a NUMBER OR STRING, and then increments $count's value.
> ++$count increments $count's value, and returns THE SCALAR ITSELF.
> 
> How does this matter?  Well, watch:

[ fun and games with ++ ]

> CRAZY.  Or logical.  Both, really.

Documented.  And guaranteed not to change.  Neither, really.

( At least, I don't think so. )

I'm reminded of the man page for csh:

  Although robust enough for general use, adventures into the esoteric
  periphery of the C shell may reveal unexpected quirks.

Fortunately, Perl's esoteria is less pronounced than that of the C shell.

> Oops.  This is [EMAIL PROTECTED]  Sorry. ;)

Perl internals for beginners :-)

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to