cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: perl addition problem

From: Linus Nielsen Feltzing <linus_at_haxx.se>
Date: Thu, 09 Sep 2004 13:59:31 +0200

Siva wrote:

> Hi,
> I have a doubt in Perl Addition concept.
>
> print (3+4)+7;
> Answer is : 7

This is interpreted as:

      print(3+4) +7;

where the arguments to print are enclosed in parenthesis, and the result
from the print function is added to 7 and discarded.

Try this for example:

     $a = print(3+4)+7;
     print "\n$a\n";

The output will be:

7
8

The print function returns 1, and 1+7 is 8.

Linus
Received on 2004-09-09