in reply to building files from parsed html content

Something like this should work for the content replacement. If you actually need the script to determine the files as well, I'd recommend opendir and readdir, or File::Find.

Perl Code
#! /usr/bin/perl use strict ; use warnings ; $|++ ; use Template ; my $tt = new Template ; foreach ( <DATA> ) { chomp ; open IN, $_ ; my @lines = <IN> ; close IN ; my $indata = join '', @lines ; my $outdata = '' ; $tt->process( 'template.tt2', { title => $_, content => $indata }, \$outdata ) or die $tt->error ; open OUT, ">$_" ; print OUT $outdata ; close OUT ; } exit ; __DATA__ my_file.html
my_file.html
<center><h1>My File</h1></center> <hr /> <p>This is my file.</p>
template.tt2
<table align="center" width="75%"> <tr> <th>[% title %]</th> </tr> <tr> <td>[% content %]</td> </tr> </table>

_______________
D a m n D i r t y A p e
Home Node | Email