#!/usr/local/perl5 $OUT = "/u/jreades/"; undef $/; while (my $file = shift) { open(IN, "<" . $file) or die ("Couldn't open file (" . $file . ") to read: " . $!); open(OUT, ">" . $OUT . "test.html") or die ("Couldn't open file (" . $OUT . $file . ") to write: " . $!); print STDOUT "Reading: " . $file . "\n"; print STDOUT "Writing: " . $OUT . "test.html\n"; my $keywords, $description, $tag; my $text = ; while ($text =~ s/<([^>]+)>//) { my $tag = $1; if ($tag =~ /NAME="(keywords|description)/i) { my $meta = $+; (${$meta}) = $tag =~ /CONTENT="([^"]*)"/i; print OUT $meta . ": " . ${$meta} . "\n\n"; } } $text =~ s/\n{3,}/\n/g; print OUT $text; close IN; close OUT; } exit 0;