Re: Difference between $count++ and ++$count

2002-12-07 Thread Paul Johnson
On Fri, Dec 06, 2002 at 03:30:35PM -0800, david wrote: > Paul Johnson wrote: > > > But it might. The behaviour is undefined. The compiler may do as it > > will. Google for "sequence point" if you want to find out more. > > > > The behaviour in Perl is undefined too, but more in the sense that

Re: Difference between $count++ and ++$count

2002-12-06 Thread Dr. Poo
HAHAHAHAHAHA! -Chris On Friday 06 December 2002 03:51 pm, [EMAIL PROTECTED] wrote: > He forgot to mention the: > > use Advil; > > $pills = new Advil(2); > unless($pills->take(orally)) { > sleep 40; > } > > http://danconia.org > > >

Re: Difference between $count++ and ++$count

2002-12-06 Thread david
Paul Johnson wrote: > But it might. The behaviour is undefined. The compiler may do as it > will. Google for "sequence point" if you want to find out more. > > The behaviour in Perl is undefined too, but more in the sense that the > behaviour has not been defined rather than that the behaviour

Re: Difference between $count++ and ++$count

2002-12-06 Thread Paul Johnson
On Fri, Dec 06, 2002 at 02:46:13PM -0800, david wrote: > btw, the ++$i / ++$i gives you a 1 thing behaves differently in other > programming languages. For example, try the following in C++: > > #include > void main{ > int i=2; > int j=++i/++i; > cout< } > > won't give y

Re: Difference between $count++ and ++$count

2002-12-06 Thread david
Jeff 'Japhy' Pinyan wrote: > > 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 retur

Re: Difference between $count++ and ++$count

2002-12-06 Thread Paul Johnson
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 i

Re: Difference between $count++ and ++$count

2002-12-06 Thread wiggins
He forgot to mention the: use Advil; $pills = new Advil(2); unless($pills->take(orally)) { sleep 40; } http://danconia.org On Fri, 6 Dec 2002 16:22:19 -0500 (EST), "Jeff 'japhy' Pinyan" <[EMAIL PROTECTED]> wrote: > On Dec 6, Paul Johnson sai

Re: Difference between $count++ and ++$count

2002-12-06 Thread Jeff 'japhy' Pinyan
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 y

Re: Difference between $count++ and ++$count

2002-12-06 Thread Paul Johnson
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. -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For ad

RE: Difference between $count++ and ++$count

2002-12-06 Thread Danny Miller
Well, it depends how you use them. Strictly speaking, ++$count is faster than $count++. say $count = 5 $num1 = $count++; #$num1 would = 5 and $count would = 6 $num2 = ++$count; #$num2 and $count would equal 6 Regards, Danny -Original Message- From: Mystik Gotan [mailto:[EMAIL PROTECTE

Re: Difference between $count++ and ++$count

2002-12-06 Thread simran
Yup... good catch... i should run my code rather than just type it in a mail window i guess :-) > Don't you mean ++$count?? > > > my $i = $++count; > > print "$i\n"; > > > > On Sat, 2002-12-07 at 03:54, Mystik Gotan wrote: > > > Hiya, > > > > > > is there any difference between $count++

RE: Difference between $count++ and ++$count

2002-12-06 Thread Yacketta, Ronald
Gah! bassackwards again :( -Original Message- From: LRMK [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 12:11 To: Yacketta, Ronald Cc: [EMAIL PROTECTED] Subject: Re: Difference between $count++ and ++$count ++$count will increment $count before it is used $count++ will

Re: Difference between $count++ and ++$count

2002-12-06 Thread LRMK
: Friday, December 06, 2002 11:02 PM Subject: RE: Difference between $count++ and ++$count > Yes > > If I recall correctly: > > ++$count will increment $count after it is used > $count++ will increment $count before it is used > > -Ron > > -Original Message- > F

Re: Difference between $count++ and ++$count

2002-12-06 Thread Dr. Poo
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_i

Re: Difference between $count++ and ++$count

2002-12-06 Thread Dr. Poo
On Friday 06 December 2002 11:09 am, simran wrote: > Yup... > > In program 1 you will get $i to be 1 and then $count will be set to 2 > In program 2 you will get $count to be set to 2 and then assigned to $i > so now $i will also be 2. > > Its just a prcedence thing... > > Program 1 > --

RE: Difference between $count++ and ++$count

2002-12-06 Thread Wagner, David --- Senior Programmer Analyst --- WGO
$count++ - will display value then add ++$count - will add then display as in where $count = 5; printf "%5d\n", $count++ ; would display 5 and $count would be 6 printf "%5d\n", ++$count ; would add then display 6

Re: Difference between $count++ and ++$count

2002-12-06 Thread simran
Yup... In program 1 you will get $i to be 1 and then $count will be set to 2 In program 2 you will get $count to be set to 2 and then assigned to $i so now $i will also be 2. Its just a prcedence thing... Program 1 -- my $count = 1; my $i = $count++; print "$i\n"; Program 2

Re: Difference between $count++ and ++$count

2002-12-06 Thread stelid-6
Yes it is a differense. code: #!/usr/bin/perl -w use strict; my $hepp = 3; my $hopp; $hopp =++$hepp; print "hopp: $hopp\n"; $hepp = 3; $hopp = $hepp++; print "hopp: $hopp\n"; Mystik Gotan wrote: > > Hiya, > > is there any difference between $count++ and ++$count? > Just wondering. > >

RE: Difference between $count++ and ++$count

2002-12-06 Thread Paul Kraus
Yes $count++ is incremented afterwards where ++$count is incremented first $a=1 C$=++a$ #c$ gets 2 C$=a$++ #c$ gets 1 and then a$ is increment to 2 Print "$c $a" #returns "1 2". Paul > -Original Message- > From: Mystik Gotan [mailto:[EMAIL PROTECTED]] > Sent: Friday, December 06, 2002 11

RE: Difference between $count++ and ++$count

2002-12-06 Thread Yacketta, Ronald
Yes If I recall correctly: ++$count will increment $count after it is used $count++ will increment $count before it is used -Ron -Original Message- From: Mystik Gotan [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 11:54 To: [EMAIL PROTECTED] Subject: Difference between $coun