cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: perl addition problem

From: Kjell Ericson <Kjell.Ericson_at_haxx.se>
Date: Thu, 9 Sep 2004 13:54:40 +0200 (CEST)

On Thu, 9 Sep 2004, Siva wrote:

> I have a doubt in Perl Addition concept.

Why ask a curl forum then?

> print (3+4)+7;
> Answer is : 7
> print 7+(3+4);
> Answer is : 14

> Why? In what basis it is giving such output? Why it neglecting after
> paranthesis value?

It's not neglecting, but it sees the paranthesis as something else than
something that returns a value. An array I guess.

print 0+(3+4)+7; # Gives 14
$a=(3+4)+7; # Gives 14
print ((3+4)+7); # Gives 14

I understand your confusion, but then what is perl without confusion :-)

  // Kjell
Received on 2004-09-09