good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I think I'd have to pour over this code awhile to figure out exactly what it is that's going wrong. I did notice one thing though.
The problem here is that you've slurpped the file into $tmp. So it can't read it again in your while loop unless you add the like:
That will start reading again at the beginning of FILE. That should allow you to loop through the contents of the file using while. That said I think you are making this problem much harder than it should be. I do have a couple of questions though: You said that you were trying to change the colors of the page based on the amount of time that had passed. Time since what? Since the page was last accessed? Since it was updated? Either way it sounds like you could benefit from HTML::Template (availiable from CPAN). Here's a short example that would change the background color based on the time of day:
Then in a separate HTML file called htmlbackground.tmpl:
When you call the script it substitutes <tmpl_var name=bgcolor> for the background color variable based on the time of day. If you would prefer to save it as a static file simply open a new file and print the template's contents to it rather than to STDOUT (which in this case is the webserver). Hope that helps In reply to Oh my, code overload
by cfreak
|
|