hogtied
10-12-2002, 01:07 AM
I've created a perl scritp that prints the users email address along with the date into and text file. The problem I'm having is that when I view the text file the date and email address is on two different lines.
Example:
date
E-mail address
What I want is:
date , email address
date , email address
I want to be able to import this into a database or spreadsheet, Hence the comma.
Here's the script:
#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
$queryString = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $queryString);
foreach $nameValue (@pairs)
{
($name, $value)= split (/=/, $nameValue);
$email{$name}=$value;
}
$date = `date`;
$emailFile = "newsletter.txt";
open (FILE, ">> $emailFile") || die ("Cannot Open File");
print FILE "$date";
print FILE "$email{'txtEmail'}";
close (FILE);
Thanks,
Hogtied
Example:
date
E-mail address
What I want is:
date , email address
date , email address
I want to be able to import this into a database or spreadsheet, Hence the comma.
Here's the script:
#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
$queryString = $ENV{'QUERY_STRING'};
@pairs = split (/&/, $queryString);
foreach $nameValue (@pairs)
{
($name, $value)= split (/=/, $nameValue);
$email{$name}=$value;
}
$date = `date`;
$emailFile = "newsletter.txt";
open (FILE, ">> $emailFile") || die ("Cannot Open File");
print FILE "$date";
print FILE "$email{'txtEmail'}";
close (FILE);
Thanks,
Hogtied