-die "Usage: $0 filter-file\n" unless (@ARGV == 1) ;
-open(INPUT, "< $ARGV[0]") or die "Coudln't open input file $ARGV[0] because $!\n";
-
-while (<INPUT>) {
- if (/^FILTER: ([-\w]+) (.*)$/) {
- $comment_lines .= "# $1:" . (" " x (20-length($1))) . "$2\n";
- $action_lines .= "+filter{$1} \\\n";
- $sgml_source_1 .= " <para>\n <anchor id=\"filter-$1\">\n <screen>+filter{$1}" .
- (" " x (20-length($1))) . "# $2</screen>\n </para>\n";
- $sgml_source_2 .= " -<link linkend=\"FILTER-" . uc($1) . "\">filter{$1}</link> \\\n";
- }
+use strict;
+use warnings;
+
+my (%comment_lines, %action_lines, %sgml_source_1, %sgml_source_2);
+
+sub main() {
+
+ die "Usage: $0 filter-file\n" unless (@ARGV == 1) ;
+ open(INPUT, "< $ARGV[0]") or die "Coudln't open input file $ARGV[0] because $!\n";
+
+ parse_file();
+ print_markup();