動くかわからんけどとりあえずできた sub read_file_to_array { #←? my $file = shift; open (FILE, "<$dir\\$database\\Defect\\$file") or die "Can't open $file\n"; open (OUT1, ">$dir\\$database\\Defect\\${file}_1") or die; open (OUT2, ">$dir\\$database\\Defect\\${file}_2") or die; my ($flag1, $flag2); while (<FILE>) { if ( /-1/ ) { $flag1 = 1; } if ( /-2/ ) { $flag2 = 1; $flag1 = 0; } if ($flag2) { print OUT2; next; } if ($flag1) { print OUT1; next; } } } |