open(F1,">test.dat");
open(F,"test.txt");
while()
{
/^(S{1})/i;
$hash_segment{$1}++;
print F1;
}
close(F);
close(F1);
open(F,"test.dat");
while()
{
/^(S{1})/i;
if ($hash_segment{$1}<=2)
{
if (!exists($hash_new{$1}))
{
$filename='valid'.$1.'.dat';
open (FO,">$filename");
}
$hash_new{$1}='';
print FO;
}
else
{
$hash_rest{$1}='';
}
}
close(F);
undef %hash_new;
undef %hash_segment;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/94041/viewspace-900276/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/94041/viewspace-900276/