CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: simple question

  1. #1
    Join Date
    Dec 2005
    Posts
    32

    simple question

    Just start learn Perl..

    I try this:
    Code:
    $in1=<STDIN>;
    $in2=<STDIN>;
    
    $x1=$in1==$in2;
    print("$x1");
    Question:
    enter 1 and 1, I got 1;
    but enter 1 and 2, I got nothing, suppose to be 0, right?

  2. #2
    Join Date
    Nov 2004
    Location
    Slough, UK
    Posts
    184

    Re: simple question

    The value it holds is actually false. False can also be represented by a null string. Convert it to an integer and you'll see 0:

    $x1 = (integer) ($in1 == $in2);
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || ClickOnline ||

    Did I ever say I was an expert?

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Please mark threads resolved by going to the thread tools menu and clicking the Mark Thread Resolved button.

    Has a post really helped you? Please Rate it.

  3. #3
    Join Date
    Dec 2005
    Posts
    32

    Resolved Re: simple question

    Quote Originally Posted by visualAd
    The value it holds is actually false. False can also be represented by a null string. Convert it to an integer and you'll see 0:

    $x1 = (integer) ($in1 == $in2);
    Thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured