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
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 .
>
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 ,
>
>
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