in reply to Re^3: Random F%^k up strings!
in thread Random F%^k up strings!

Then why does it WORK when I remove the '#' from '# $answer = "ghRuE"; <-- If I use this it works fine.' this line. and type in 'qhrue' then click on verify? All I asked from the beginning was why doesn't the random generate $answer work?

Replies are listed 'Best First'.
Re^5: Random F%^k up strings!
by huck (Prior) on May 22, 2017 at 18:14 UTC

    Each time that runs because the user pressed verify it generates a new $answer, that bears no relationship to whatever was typed into $useranswer the previous time it was displayed to the user

    Then why does it WORK when I remove the '#' from '# $answer = "ghRuE";

    Because the $answer stays the same each time the program runs since it is not generated anew each time the cgi runs and is static from run to run. The random generation of $answer worked just fine and the comparison worked just fine, it is just that since $answer was regenerated from scratch each time the program ran it didnt match what was generated the last time the program was run, and that previous version was what was displayed to the user for them to type in and was then returned in $useranswer.