Mercurial > mercurial > hgweb_iklist.hg.cgi
diff prog/07.pl @ 1:13e80a745ef0 draft
beta2 release.
author | pyon <pyon@macmini> |
---|---|
date | Tue, 24 Aug 2021 21:30:47 +0900 |
parents | |
children | c0f76f8e67fa |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/prog/07.pl Tue Aug 24 21:30:47 2021 +0900 @@ -0,0 +1,31 @@ +# ファイル分割 + +my $tmp = "pdf"; +my $buf0; +for my $file (glob "_data03/*") { + + open my $fi, '<', $file; + binmode($fi); + + read($fi, $buf0, 4); + + open my $fo, '>', $tmp; + binmode($fo); + + my $buf; + while (read($fi, $buf, 1024)) { + print {$fo} $buf; + } + close $fo; + + close $fi; + + my $fn = substr $file, 1; + rename $tmp, $fn; +} + +open my $f, '>', $tmp; +binmode($f); +print {$f} $buf0; +close $fo; +