view prog/07.pl @ 3:d3e201c48ff8 draft default tip

bug fix.
author pyon
date Wed, 29 Sep 2021 22:04:51 +0900
parents c0f76f8e67fa
children
line wrap: on
line source

# ファイル分割

my $tmp = "pdf";
my $buf0;
for my $file (glob "_03/*") {

	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;