jinnks has asked for the wisdom of the Perl Monks concerning the following question:
Please advise thanks jinnks#!/usr/bin/perl -w use strict; use warnings; use CGI; use CGI::Carp qw(fatalsToBrowser); my $query= new CGI; my $filename= "testfile.txt"; my $value; my $fname; my $lname; my $textarea; $'="|"; sub Writing_to_file { my @input_to_file=@_; open (DAT, ">>$filename") || die ("no file exists"); print DAT join($', @input_to_file), "\n"; close(DAT); } sub display_on_browser { open (DAT, $filename) || die ("no file exists"); my @data_in_the_file=<DAT>; close(DAT); my $data_to_read; print "Content-type:text/html\n\n"; print"<html><head><title>Guestbook</title></head><body>"; foreach $data_to_read(@data_in_the_file) { my @delimiter_to_remove=$data_to_read; @delimiter_to_remove=~s/\$'/\n/g; print "<table border=1><tr><td>@delimiter_to_remove\n< +br></td></tr></table>"; } print "<a href=http://guestbook.ds5403.dedicated.turbo +dns.co.uk/index.html><h1>Back to guestbook</a>"; print "</body></html>"; } $fname=$query->param('name'); $lname=$query->param('name1'); $textarea=$query->param('comments'); Writing_to_file($fname,$lname,$textarea); display_on_browser();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Special variable...
by Lawliet (Curate) on Aug 06, 2008 at 02:00 UTC | |
|
Re: Special variable...
by kyle (Abbot) on Aug 06, 2008 at 02:30 UTC | |
|
Re: Special variable...
by toolic (Bishop) on Aug 06, 2008 at 02:29 UTC |