use strict; my $TAG_REGEX_ = q{[^"'<>]*(?:"[^"]*"[^"'<>]*|'[^']*'[^"'<>]*)*(?:>|(?=<)|$(?!\n))}; #'}}}} my $COMMENT_TAG_REGEX = '-]*(?:-[^>-]+)*?)??)*(?:>|$(?!\n)|--.*$)'; my $TAG_REGEX = qq{$COMMENT_TAG_REGEX|<$TAG_REGEX_}; my @FILES = (); foreach my $file (@FILES) { if (!-e $file || -s ($file) == 0) { next; } open (FILE, "<$file"); my @data = ; close (FILE); my $count = 0; my $count_new; my $data_line = "\n\n"; $data_line .= (split (/\./, $file))[0] . sprintf ("%03d", $count); $data_line .= "\n\n\n\n"; my @new_file_list = (); foreach (@data) { chomp ($_); $_ =~ s/$TAG_REGEX//; if (length ($data_line) < 1024 * 10) { $data_line .= $_ . "
\n"; next; } $count_new = sprintf ("%03d", $count); my $new_file = (split (/\./, $file))[0] . $count_new . ".html"; open (NEW, ">$new_file"); print NEW $data_line . $_ . "
\n\n\n"; close (NEW); push (@new_file_list, $new_file); $count++; $data_line = "\n\n"; $data_line .= (split (/\./, $file))[0] . sprintf ("%03d", $count); $data_line .= "\n\n\n\n"; } if ($data_line ne "") { $count_new = sprintf ("%03d", $count); my $new_file = (split (/\./, $file))[0] . $count_new . ".html"; open (NEW, ">$new_file"); print NEW $data_line . "
\n\n\n"; close (NEW); push (@new_file_list, $new_file); } my $indexfile = (split (/\./, $file))[0] . ".html"; open (HTML, ">$indexfile"); print HTML "\n\n"; print HTML (split (/\./, $file))[0]; print HTML "\n\n\n\n"; foreach my $filelist (@new_file_list) { my $linkfile = (split (/\./, $filelist))[0]; print HTML "$linkfile
\n"; } print HTML "\n"; close (HTML); }