You need to redo the script (not entirely), luckily it is a short script at ths point.
First and foremost is:
Second is don't use the -w switch on the shebang line, use the "warnings" pragma instead:
So your script should look like this at the beginning:
- #!/usr/local/bin/perl
-
-
use warnings;
-
use strict;
-
use CGI qw(:standard);
-
use Tie::File;
Thirdly, this is eventually going to get you in trouble:
if (
"$canI" eq "true"){
do not quote scalars unless you intend to make a string out of them or use them in a string. Much better written like this:
if (
$canI eq 'true'){
quotes (single and double) can hide errors in your code that "warnings" and "strict" can't even help you to find. For example:
if ("canI" eq "true"){
You could stare at your code for hours and not spot that error and your code would run and not return any errors or warnings. If you think you would never make an error like that you just haven't written enough perl code yet or you're insane (just a joke mate).
Forth: You wisely test for system success/failure with "die" but then fail to print out the reason the expression died:
tie @res, 'Tie::File', "../results.txt" or die
"Can't Tie::File "../results.txt: $!";
Fifth: saying "it doesn't work" is no help to us. What does it do? What doesn't it do? We need details and any error messages.
This is odd:
Here are your results:<a href="../results.txt">Click Here</a>
Normally hyper links do not point to .txt files. But that is something you can fix later.