edatz
07-19-2010, 01:36 PM
I have a script which I use to access some files. The first step of the processs is to enter a word in a form, which then passes me to the file.
words.txt (the file with the words in)
pizza
beer
open (AWDF,"words.txt");
$first = <AWDF>;
close (AWDF);
$theword = "$first";
print "$theword"; # ----- works fine
The print shows the first word in the file like it should. It even passes to other parts of the script and can be printed (for testing).
However, when I use word in a form to do the first step in the process of the script - it does not work.
But it will if the variable is like this!
$theword = "pizza";
...and everything works properly.
I don't understand why the variable will work one way, but not the other. What have I done wrong?
Any ideas?
words.txt (the file with the words in)
pizza
beer
open (AWDF,"words.txt");
$first = <AWDF>;
close (AWDF);
$theword = "$first";
print "$theword"; # ----- works fine
The print shows the first word in the file like it should. It even passes to other parts of the script and can be printed (for testing).
However, when I use word in a form to do the first step in the process of the script - it does not work.
But it will if the variable is like this!
$theword = "pizza";
...and everything works properly.
I don't understand why the variable will work one way, but not the other. What have I done wrong?
Any ideas?