sidhartha has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl open IN, "<bg.cnt" or die "can't open bg.cnt"; flock(IN,2); seek(IN,0,0); $cnt=<IN>; close IN; if ($cnt >= 3){ $cnt = 0; } else { $cnt = $cnt + 1; } open OUT, ">bg.cnt" or die "can't open bg.cnt for writing"; flock (OUT, 2); seek(OUT,0,2); print OUT "$cnt \n"; close OUT; @background=("corner.jgp","anduin.jpg","gandalf.jpg","ford.jpg"); print "Content-type: text/html\n\n"; print <<EndOfHTML; <td background="images/$background[$cnt]"> EndOfHTML
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: writing to a file in a cgi script
by gav^ (Curate) on Feb 08, 2002 at 02:38 UTC | |
by Kanji (Parson) on Feb 08, 2002 at 07:29 UTC | |
by sidhartha (Acolyte) on Feb 08, 2002 at 15:45 UTC | |
|
(cLive ;-) Re: writing to a file in a cgi script
by cLive ;-) (Prior) on Feb 08, 2002 at 04:43 UTC | |
|
Re: writing to a file in a cgi script
by Kanji (Parson) on Feb 08, 2002 at 07:38 UTC | |
|
Re: writing to a file in a cgi script
by redsquirrel (Hermit) on Feb 08, 2002 at 06:12 UTC | |
by sidhartha (Acolyte) on Feb 08, 2002 at 15:49 UTC | |
|
Re: writing to a file in a cgi script
by rjray (Chaplain) on Feb 08, 2002 at 07:33 UTC |