Mercurial > mercurial > hgweb_iklist.hg.cgi
comparison prog/07.pl @ 1:13e80a745ef0 draft
beta2 release.
| author | pyon <pyon@macmini> |
|---|---|
| date | Tue, 24 Aug 2021 21:30:47 +0900 |
| parents | |
| children | c0f76f8e67fa |
comparison
equal
deleted
inserted
replaced
| 0:520044113ef0 | 1:13e80a745ef0 |
|---|---|
| 1 # ファイル分割 | |
| 2 | |
| 3 my $tmp = "pdf"; | |
| 4 my $buf0; | |
| 5 for my $file (glob "_data03/*") { | |
| 6 | |
| 7 open my $fi, '<', $file; | |
| 8 binmode($fi); | |
| 9 | |
| 10 read($fi, $buf0, 4); | |
| 11 | |
| 12 open my $fo, '>', $tmp; | |
| 13 binmode($fo); | |
| 14 | |
| 15 my $buf; | |
| 16 while (read($fi, $buf, 1024)) { | |
| 17 print {$fo} $buf; | |
| 18 } | |
| 19 close $fo; | |
| 20 | |
| 21 close $fi; | |
| 22 | |
| 23 my $fn = substr $file, 1; | |
| 24 rename $tmp, $fn; | |
| 25 } | |
| 26 | |
| 27 open my $f, '>', $tmp; | |
| 28 binmode($f); | |
| 29 print {$f} $buf0; | |
| 30 close $fo; | |
| 31 |
