Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Possible to refer to variable defined later in script?

by marto (Chancellor)
on Nov 12, 2012 at 15:56 UTC ( #1003471=note: print w/ replies, xml ) Need Help??


in reply to Possible to refer to variable defined later in script?

Wouldn't the simple (and sane) thing be to output the HTML after you have processed your input and given values to variables? Also, you may want to consider using HTML::Template or similar to separate your Perl code from your HTML/CSS/JS.

You could also consider making this a dynamic page rather than writing a static HTML file each time the script runs. Though this may be out of scope for this coursework.

Update:

I don't know if this is your entire code, but I'd suggest adding use strict; use warnings; (see Use strict and warnings or search for more), ensure you're opening files properly by checking for errors, for example:

open (LOG, '<', 'IN-access.log') or die "cannot open < IN-access.log: +$!";

Such things help prevent facepalm.


Comment on Re: Possible to refer to variable defined later in script?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1003471]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2014-09-02 20:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (29 votes), past polls