Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

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

by marto (Archbishop)
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.


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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1003471]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2018-05-21 03:41 GMT
Find Nodes?
    Voting Booth?