# # # Debug code cutter # # #デバッグ用のコード部分を削除し拡張子を変えて出力する # #--------------------------------- $token='^#>>>DEBUG_CODE'; #Debug code token $new_exp='.pl'; #Replace exppression #--------------------------------- $i=0; $mode=1; while( @ARGV > $i ) {#全てのファイルを処理するまで #ファイルオープン open(IN,$ARGV[$i] )|| die "Can not open $ARG[$i],\n"; $out=$ARGV[$i]; $out=~ s/\.\w+/$new_exp/; open(OUT,">$out")||"Can not create $out.\n"; while() { if( $_ =~ /$token/ ) {#find token $mode = !$mode; } else { if( $mode ) { print OUT $_; } } } ++$i; }