#!/usr/bin/perl # replace Zenkaku space -> 2 spaces ## def $Zspace = '(?:\xA1\xA1)'; #EUC-JP, #taken from http://www.din.or.jp/~ohzaki/perl.htm $Zspace_sjis = '(?:\x81\x40)'; # SJIS ## IO print "Type extension of input files = "; chop($suffix =); ## read current dir @files = (); opendir(DIR, "."); @files = grep(/.$suffix/, readdir(DIR)); closedir(DIR); print @files; # debug ## for each file foreach $file (@files) { # `nkf -eLu $file > $file.euc`; ### if necessary #open (DATA, "$file.euc"); ### when using the above line open (DATA, "$file"); open (OUT, ">sp-$file"); # loop while () { s/($Zspace)/ /g; print; print OUT; } }