I am having problems with logistics. Here's what I want to do: a script gets a list of all (html) filenames in a directory tree, opens each file and gets the html title. It then prints out all titles, linked to the corresponding filenames.
Now, I have managed the first step and have all filenames in @files. For the next step, I did:
foreach $file (@files) {
open (FILE, "<$file") || die("Can't open $file.");
chomp(@file = <FILE>);
close (FILE);
$filedata = join("", @file);
if ($filedata =~ /(<title>)(.*?)(<\/title>)/) {
$title = $2;
push (@titles, $title);
}
At this point I got stuck. I have all filenames in @files, and all titles in @titles, but how do I display each title together with the corresponding filename?
kellner
Now, I have managed the first step and have all filenames in @files. For the next step, I did:
foreach $file (@files) {
open (FILE, "<$file") || die("Can't open $file.");
chomp(@file = <FILE>);
close (FILE);
$filedata = join("", @file);
if ($filedata =~ /(<title>)(.*?)(<\/title>)/) {
$title = $2;
push (@titles, $title);
}
At this point I got stuck. I have all filenames in @files, and all titles in @titles, but how do I display each title together with the corresponding filename?
kellner