Re: Increment Operator (++) question in Perl

2009-11-03 Thread John W. Krahn
Majian wrote: Hi ,all: Hello, When I test the increment operator in Perl and find a question : The question is : #!/usr/bin/perl use warnings; my $i = 1; print ++$i + ++$i, "\n"; The above code prints out the answer 6 . But in the other language the anser is 5 , And the lesson t

Re: Increment Operator (++) question in Perl

2009-11-03 Thread Paul Johnson
On Tue, Nov 03, 2009 at 07:15:43PM +0800, Majian wrote: > Hi ,all: Hello, > When I test the increment operator in Perl and find a question : > > The question is : > #!/usr/bin/perl > use warnings; > > my $i = 1; > print ++$i + ++$i, "\n"; > > The above code prints out the answer 6 . >

Re: Increment Operator (++) question in Perl

2009-11-03 Thread Philip Potter
2009/11/3 Majian : > Hi ,all: > >  When I test the increment operator in Perl and  find   a question : > > The question is : > #!/usr/bin/perl > use warnings; > > my $i = 1; > print  ++$i  + ++$i, "\n"; > > The above code prints  out  the answer 6 . > But in the other language  the anser is 5 , > >

Re: Increment Operator (++) question in Perl

2009-11-03 Thread Erez Schatz
2009/11/3 Majian : > > my $i = 1; > print  ++$i  + ++$i, "\n"; > > The above code prints  out  the answer 6 . > But in the other language  the anser is 5 , > >From the documentation (http://perldoc.perl.org/perlop.html#Auto-increment-and-Auto-decrement): "Note that just as in C, Perl doesn't defi

Re: increment operator

2006-04-08 Thread Alan_C
On Saturday 08 April 2006 20:19, Chris Charley wrote: > - Original Message - > From: "Alan_C" <[EMAIL PROTECTED]> [ . . ] > > Hi, > > > > [EMAIL PROTECTED]:~$ this_pl_script word array print > > > > $size prints at 3 and it finds each of the 3 words entered on the command > > line. > > > >

Re: increment operator

2006-04-08 Thread Chris Charley
- Original Message - From: "Alan_C" <[EMAIL PROTECTED]> Newsgroups: perl.beginners To: Sent: Saturday, April 08, 2006 8:47 PM Subject: increment operator Hi, [EMAIL PROTECTED]:~$ this_pl_script word array print $size prints at 3 and it finds each of the 3 words entered on the comm

Re: increment operator

2006-04-08 Thread Chris Charley
- Original Message - From: "Alan_C" <[EMAIL PROTECTED]> Newsgroups: perl.beginners To: Sent: Saturday, April 08, 2006 8:47 PM Subject: increment operator Hi, [EMAIL PROTECTED]:~$ this_pl_script word array print $size prints at 3 and it finds each of the 3 words entered on the comm