Hi Anon. This code will/does work
#!/usr/local/bin/perl use strict; use CGI::Carp qw(fatalsToBrowser); # this is the required header print "Content-type: text/html\n\n"; # this will go to the browser print "<h1>Show me 'Hello World!' the browser window!</h1>" my $file = "new_guestbook.html"; open(F,"+< $file") or die "Could not open $file: $!"; my @file = <F>; s/date/localtime/eg for @file; seek F,0,0 or die "Could not seek in $file: $!"; truncate F,0 or die "Could not truncate $file: $!"; print F @file; # this rewrites file close F; # this goes to browser, you see nothing if @file is empty print @file
Run the code above. You will see at least the message in the browser window. If you do not see your file then specify an accurate full path to that file and make sure it is not empty (if you want to see something).
cheers
tachyon
s&&rsenoyhcatreve&&&s&n\w+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: Re: Re: (tye)Re: file opening question
by tachyon
in thread CGI Server Error
by deriwana
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |