Hello,
Can you guys tell me on this piece of codes? It doesn't print the small
html codes in the sub below. No warning - nothing!
N.B. Don't bother about the html; just check my perl codes to see why I
doesn't print what I want.
Thanks
Babs
=============================================================
#!/usr/bin/perl -w
use strict;
use File::Basename;
my ($filename, $dir, $ext,$picture,$images,$counter);
$images ="watches";
opendir (IMGDIR, "$images") || die "\nCouldn't open directory ($images):
$!\n";
#while (defined($picture = readdir(IMGDIR))){
my @pictures = readdir(IMGDIR);
foreach $picture (@pictures){
$counter = 0;
if (-f $picture and $picture =~ /(\.gif|\.jpe?g)$/i){
$counter++;
($filename, $dir, $ext) = fileparse($picture,
'\..*');
print "$picture,$filename";
html_file($picture,$filename );
}
}
closedir(IMGDIR);
print "\n$counter templates printed successfully.";
############################################################
# HTML Layout #
############################################################
sub html_file {
my ($filename,$picture );
($picture,$filename) = @_;
opendir (TMPLDIR, "Tmpl_out") || die "$!\n";
open (OUT, ">TMPLDIR/$filename.txt") || die "$!\n";
print OUT <<EOF;
<html><head><title>$filename</title></head>
<body><font face=" Arial, Times New Roman,Helvetica">
<p align="center">
<img src="$picture" border="1" color="#ffffff"></p>
<table><tr><td><table align="center">
<tr><td colspan="3" width="90%"
align="center"> </font></td></tr>
<tr bgcolor="#boc4de"><td colspan="3" >
</td></tr><tr><td height="200">
<img src="$picture"></td><td height="200">
<img src="$picture"></td></tr></table>
EOF
close (OUT);
closedir (TMPLDIR);
}
#=======================================================================
=
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>