Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

newbie question - writing to a file 1

Status
Not open for further replies.

HaroldMcF

MIS
Jul 29, 2002
8
US
I can't seem to get this piece of code to work. It is supposed to get a parameter (complete path and filename) from an html form, open a file at that location, print the data, and close the form.
The relevant lines of code are as follows:

my $filenew = param("comppath");
open(writenew, ">$filenew");
print writenew "@holdinfo2";
close(writenew);

It does get the path correctly because if I rem out the open, print, and close lines and tell it to print the variable $filenew it prints the complete path and filename.
If I copy that information and past it into the open(writenew, ">pastedhere"); then it works correctly and does write to the directory and filename.
It does not work when passed as a variable, only when the exact same information is hand entered into the command to open the file.
I would appreciate any input.
 
Are you running the script in taint mode? If you are Perl won't let you pass unparsed input to system calls or operations that modify files (like open()), so you'll have to un-taint $filenew.

jaa

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top