Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Simple Perl/CGI Question

  • 30-07-2001 02:48PM
    #1
    Registered Users, Registered Users 2 Posts: 1,202 ✭✭✭


         if($rent_parse2 eq " ")
         {
            $stupid_2=$stupid-10;
            $stupid_2=$stupid_2+$count2;
            $whatout = substr($FORM{'comment'}, $count, $stupid_2);
            $count2=10;
         }
    

    Im only learning perl a bit, and while thats crude enough in its self, Just one thing I need to know is this:

    this line
    if($rent_parse2 eq " ")

    Does not catch it, is there some sort of function or something that I should replace " " with?

    Thanks

    RentZ



Comments

  • Closed Accounts Posts: 577 ✭✭✭Chubby


    The code looks correct if you are comparing the string variable $rent_parse2 to a white space.

    Try this to confirm the comparison to space works.
    $huh = " ";
    if($huh eq " "){
    print "huh\n"
    }

    So only conclusion is what $rent_parse2 doesn't have the value " " (a space) when the code reaches the if statement. Put the following line before it reaches the if statement to see what value it has.

    print $rent_parse2

    [This message has been edited by Chubby (edited 30-07-2001).]


  • Registered Users, Registered Users 2 Posts: 2,660 ✭✭✭Baz_


    What are you trying to do witht that code mate???


  • Registered Users, Registered Users 2 Posts: 4,660 ✭✭✭Gavin


    Perchance try

    if("$rent_parse2" eq " ")

    Include the quotes around the variable. If it's just a blank variable you are looking for, then perl will default that to a boolean false .. i think.

    ie,

    if($rent_parse)
    {
    print "true, text in the variable" ;
    }

    Gav


    Gav


  • Closed Accounts Posts: 4 -gAuD-


    what are you trying to do ??

    what are you testing for ?? whitespace ?? empty string ?? undef ??

    Are you sure the value of the string $rent_parse2 is what you think it is ??



Advertisement