<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;"># getanchor.pl - extract anchor list
# Copyright (C) TOYODA Eizi, 2000.  All rights reserved.

sub register($$) {
	local($name, $where) = @_;
	$name =~ s/\s//g;
	$where =~ s/\s//g;
	print OUTPUT $name, "\t", $where, "\n";
}

open(OUTPUT, "&gt;anchor.txt") || die "anchor.txt: $!";

opendir(DIR, ".");
@ARGV = grep(/\.html$/, readdir(DIR));
closedir(DIR);

while (&lt;&gt;) {
	next unless /name=/i;
	while (1) {
		last unless /\bname\s*=/i;
		if (/\bname\s*=\s*(\w+)/i) {
			$anchor = $1;
			&amp;register($anchor, $ARGV);
		} elsif (/\bname\s*=\s*["']([^"']*)["']/i) {
			$anchor = $1;
			&amp;register($anchor, $ARGV);
		} else {
			print "cannot recognize line: '$_'\n";
		}
		s/\bname\s*=/XXXX/i;
	}
}

close(OUTPUT);
</pre></body></html>