XML Reference problem

Discussion in 'Perl Misc' started by sharon@blue-linedesign.com, Jan 22, 2008.

  1. Guest

    I have an XML hash that has $xmlResults->{Ack} = Failure
    I use an if statement with $xmlResults->{Ack} == "Success" and getting
    true instead of false.
    I about to pull some hairs about and I don't have to many left, please
    help me save the last ones I have.


    thanks
    Arik
    , Jan 22, 2008
    #1
    1. Advertising

  2. writes:

    > I use an if statement with $xmlResults->{Ack} == "Success" and getting
    > true instead of false.


    When comparing strings you have to use the string comparison operator
    instead of the number comparison operator. That is to use
    '$xmlResults->{Ack} eq "Sucess"' instead.

    By using '==' you're comparing the numeric value of both sides, which
    is very probale 0.

    //Makholm
    Peter Makholm, Jan 22, 2008
    #2
    1. Advertising

  3. Guest

    On Jan 22, 10:54 am, Peter Makholm <> wrote:
    > writes:
    > > I use an if statement with $xmlResults->{Ack} == "Success" and getting
    > > true instead of false.

    >
    > When comparing strings you have to use the string comparison operator
    > instead of the number comparison operator. That is to use
    > '$xmlResults->{Ack} eq "Sucess"' instead.
    >
    > By using '==' you're comparing the numeric value of both sides, which
    > is very probale 0.
    >
    > //Makholm


    I'm not going to be completely bold after all, thanks a lot
    , Jan 22, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page