Yes sir there is! And it's quite a goober if you ask me, but very useful.

        I'll show the difference by example.

my $SOME_CONSTANT = 2;  # NO MAGIC NUMBERS! (hehe)

my $pre_increment = 0;
my $post_increment = 0;

my $pre_result = ++$pre_increment + $SOME_CONSTANT;

my $post_result = $post_increment++ + $SOME_CONSTANT;

# Notice the the ++ either before or after does incremement the variable by
# one, but ++$pre_increment does the incremental operation FIRST before then
# adding $pre_increment to $SOME_CONSTANT
# $post_increment++ does the opposite, it addes $SOME_CONSTANT to the
# pre-existing value in $post_increment, then it incremements by one.
# So, again, both as an end result are incremented by ONE, but their
# precedence is different within an EXPRESSION
print $pre_increment;   # will print '1'
print $post_increment;  # will print '1'

print $pre_result;              # will print '3'
print $post_result;     # will print '2'

To Confusing?? I've been told i am not the best teacher....so maybe someone
else on the list could help you more if this doesn't..

        -Chris

On Friday 06 December 2002 10:54 am, you wrote:
> Hiya,
>
> is there any difference between $count++ and ++$count?
> Just wondering.
>
> Thanks.
>
>
>
>
>
> _________________________________________________________________
> Ontvang je Hotmail & Messenger berichten op je mobiele telefoon met Hotmail
> SMS http://www.msn.nl/jumppage/

-------------------------------------------------------

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

Reply via email to