[plug] perl script
Adam Hewitt
ahewitt at globaldial.com
Fri Sep 26 15:55:45 WST 2003
Hi All,
I have written a basic perl script that adds email domains to a file via
a web interface. The problem that I am having is that if I add a domain
to the existing list it all works as expected, however if I add a second
domain to the list, the second domain is joined to the first one I just
added. For example if I add test2.com.au to the list I get:
<snip>
test1.com.au
test2.com.au
If I then add another domain called test3.com.au the I get
<snip>
test1.com.au
test2.com.autest3.com.au
So it appears that I am not adding a \n to the first entry.
Here is the code snippets that I feel would be causing the problems.
--------------------------------
if ($q->param('button') eq "Add") {
my $tmpstr = $q->param('domain'), "\n";
push (@domains, $tmpstr);
$donestuff=1;
--------------------------------
open(FILE, ">$file");
foreach (@domains) {
print FILE $_;
}
close FILE;
Can anyone see a reason as to why I would be missing a "\n" when it goes
to write back into the original file?
Cheers,
Adam.
_______________________________________________
plug mailing list
plug at plug.linux.org.au
http://mail.plug.linux.org.au/cgi-bin/mailman/listinfo/plug
More information about the plug
mailing list