CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
A simple question about "print" function

 



moroshko
Novice

May 24, 2008, 3:15 AM

Post #1 of 3 (341 views)
A simple question about "print" function Can't Post

Hello !

Can someone explain me please why
print 3==4;
prints nothing ?

I would expect 3==4, which is false, to be converted to 0, so I expect "print" to print "0". Where am I wrong ?

Thanks !


eWish
User

May 24, 2008, 8:22 AM

Post #2 of 3 (334 views)
Re: [moroshko] A simple question about "print" function [In reply to] Can't Post

As far as I know perl will not convert the result to zero or true or false. You have to tell it to. Here is one way of doing it.


Code
print 3 == 4 ? 'True' : 'False';



moroshko
Novice

May 24, 2008, 1:36 PM

Post #3 of 3 (329 views)
Re: [eWish] A simple question about "print" function [In reply to] Can't Post

Hi,

Thanks for the reply !

So what I don't understand is what Perl does with 3==4 ?

Why print 3==3; prints 1, and print 3==4; prints nothing ?

Thanks in advance !

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives