n00dles has asked for the wisdom of the Perl Monks concerning the following question:
But I'm finding it hard to get off the ground with things to code, I have made a few simple apps like calulators and nslookup tools. So I picked up a CGI book as I run a server and thought it would be a good place to start coding something practical.
My question is I made this to start out with and what I don't understand why if all the counter code(within comments) is placed at the bottom the whole page wont display?
So I broke it up and It all comes out fine... also this seems very long winded, if anyone has any comments I would very much like to hear them. Also if anyone has any ideas for good apps/projects to get started with.#!/usr/bin/perl -w print "Content-type: text/html\n\n"; $code = "index.html"; $counter = "counter.txt"; # countercode open(COUNTER, "< $counter") or die "$_"; $hits = <COUNTER>; close(COUNTER); # countercode open(PAGE, "< $code") or die "$_"; while(<PAGE>) { chomp($_); print "$_\n"; } close(PAGE); print "<CENTER>Hits: $hits</CENTER>"; print "<CENTER>Process ID: $$ Time: $^T</CENTER><BR>"; print "</HTML>"; #countercode open(COUNTER, "> $counter") or die "$_"; $hits++; print COUNTER "$hits"; close(COUNTER); #countercode
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Understanding ::
by bobf (Monsignor) on Jul 26, 2006 at 01:14 UTC | |
by ikegami (Patriarch) on Jul 26, 2006 at 06:19 UTC | |
|
Re: Understanding ::
by GrandFather (Saint) on Jul 26, 2006 at 01:10 UTC | |
|
Re: Understanding ::
by planetscape (Chancellor) on Jul 26, 2006 at 06:07 UTC | |
|
Re: Understanding ::
by bart (Canon) on Jul 27, 2006 at 01:45 UTC |