I am working on a script and I'm having trouble saving the info as the param $name.txt (for instance: $name = 'robs site.txt') . Instead of saving as let's say 'robs site.txt' it saves as $name.txt . How can I fix this?
Below is my script.
Note: The script below also writes <a href='$name.txt'>$name</a><br> to links.txt, but that works fine.
_______________________________________
You don't know me.
Below is my script.
Note: The script below also writes <a href='$name.txt'>$name</a><br> to links.txt, but that works fine.
Code:
#!/usr/bin/perl
use warnings;
use strict;
use CGI qw/:standard/;
$CGI::POST_MAX = 1024 * 10; # max 10K posts
$CGI::DISABLE_UPLOADS = 1; # no uploads
my $name = param('name') or error('You have to enter a name');
my $comments = param('comments') or error('You have to enter some comments');
#($name,$comments) = escapeHTML($name,$comments);
open(FH,'>>./mywebs/ETbyrne/test/portal/$name.txt') or die "$!";
print FH "<b>Name:</b> $name<br><b>Comments:</b> $comments</a><br>\n";
close (FH);
open(FH,'>>./mywebs/ETbyrne/test/portal/links.txt') or die "$!";
print FH "<a href='$name.txt'>$name</a><br>\n";
close (FH);
print "Location: [URL unfurl="true"]http://www.mywebsfree.com/ETbyrne/test/portal/index_page.shtml\n\n";[/URL]
sub error{
my $error = shift;
print header,start_html,h1($error),end_html;
exit;
}
_______________________________________
You don't know me.