Sounds like you want a templating system.
Check out these modules. All 3 are excellent.:
- Template Toolkit.
- HTML::Template
- HTML::Mason
How you would use Template Toolkit:
Create a template 'my_template.tmpl':
<html>
...
<body>
Hello [% name %], how are you today
</body>
</html>
Your perl code:
#!/usr/bin/perl -w
use strict;
use Template;
my $file = 'my_template.tmpl';
my $vars = {
name => "Schmidy"
};
my $template = Template->new();
$template->process($file, $vars)
|| die "Template process failed: ", $template->error(), "\n";
You get to seperate your presentation from your code. No more digging through html in your perl code.
grep
|
Mynd you, mønk bites Kan be pretti nasti... |
| [reply] [d/l] [select] |
If these are coming from CGI, you can even use CGI.pm directly in your template:
[% USE c = CGI; name = c.param("name"); %]
<html>
...
<body>
Hello [% name %], how are you today
</body>
</html>
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply. | [reply] [d/l] |