1#!/bin/perl -w
2
3$seq = 1;
4$file = "";
5$file = sprintf("tmp/%02d.m4", $seq);
6open(FILE, ">$file") || die "cannot open \"$file\": $!";
7printf(STDOUT "FILE: $file\n");
8while (<>) {
9    if (/^$/) {
10          close(FILE);
11          $seq++;
12          $file = sprintf("tmp/%02d.m4", $seq);
13          open(FILE, ">$file") || die "cannot open \"$file\": $!";
14          printf(STDOUT "FILE: $file\n");
15          next;
16    }
17    printf FILE;
18}
19close(FILE);
20