2
0

extract-names.pl 385 B

1234567891011121314151617181920212223242526
  1. #!/usr/bin/perl
  2. $/ = ""; # Eat a paragraph at once.
  3. while(<STDIN>) {
  4. chop;
  5. s/\n/ /gm;
  6. if (/^=head1 /) {
  7. $name = 0;
  8. } elsif ($name) {
  9. if (/ - /) {
  10. s/ - .*//;
  11. s/,\s+/,/g;
  12. s/\s+,/,/g;
  13. s/^\s+//g;
  14. s/\s+$//g;
  15. s/\s/_/g;
  16. push @words, split ',';
  17. }
  18. }
  19. if (/^=head1 *NAME *$/) {
  20. $name = 1;
  21. }
  22. }
  23. print join("\n", @words),"\n";