#!/usr/bin/perl

open(F, ">.trash");
while(<STDIN>) {
  if(/\<\!--BEGIN (.*) *--\>$/) {
      close F ;
      open(F, ">$1") or die "Cannt open $1 \n";
      print "- ", $1, "\n";
     }
     print F $_ ;
}

