"$Bill Luebkert" <[EMAIL PROTECTED]> writes:
> Dominic Pain wrote:
>
> > 'noon,
> >
> > Just having a quick discussion about coding style. I say ++$counter,
> > whereas another programmer says $counter++. He says that, in C, the second
> > form is actually slightly quicker.
> >
> > Is this also true in Perl, does anyone know?
>
> You can always benchmark it, but it's not about speed.
Both will in void context compile to exactly the same code so there is
no speed difference. I can't image that a modern C compiler will do
any worse.
> I always use $counter++ because it's more intuitive.
I too find $counter++ easier to read and always use that form in my
code. That form also seems to be natural culmination of this
sequence:
$counter = $counter + 1;
$counter += 1;
$counter++;
Regards,
Gisle Aas
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs