135Free Fire Zone: When I hear the word 'culture' I reach for the TV remote.

Free Fire Zone
Welcome to Free Fire Zone


Remark Req: 857
This Thread is closed...

I just finished resolving a vexing problem in a perl CGI script:

if ( $test eq'TESTDATA' )
{
$dresult='<option value="PositiveResult">Positive Result';
}
elsif ( $test ne'TESTDATA' )
{
$dresult='<option value="NegativeResult">Negative Result';
}

In the above example, the plugged in html code $dresult printed the first result regardless of what the value of $test was.

The solution was to make the perl script extract a part of the string, since various forms of $test existed.

Not certain why this worked, except perhaps since this script was executed by the Apache mod_perl module and not directly by the perl interpreter, perl may have "forgotten" it was the primary thread in this process, and failed its instructions.

Forcing the script to do a native, fundamental perl function, extract a string, I was able to make the script work as desired.

Solution:

$test = 'TESTDATA';
$test2 = ( substr $test, -5 );
f ( $test2 eq'TDATA' )
{
$dresult='<option value="PositiveResult">Positive Result';
}
elsif ( $test2 ne'TDATA' )
{
$dresult='<option value="NegativeResult">Negative Result';
}

I don't know if extracting the whole string would work, but there is little doubt that it would.


It has been 5288 days since this story was posted.
Discussion threads close after five days.
Sorry...
Return to the Free Fire Zone

See the full, archived discussion