Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Simple Perl/CGI Question

  • 30-07-2001 2: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,676 ✭✭✭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