1 Reply Latest reply on Aug 30, 2012 8:03 AM by EJP

    Q: Perl search and replace in file containing Japanese characters

      Hello Perl experts

      I have a Unicode Text file (saved from Excel) and would like to replace the tabs in that file with commas. I am using the following code but it seems to be changing some of the Japanese characters in the file only in certain files. If needed I can attach the original file but was wondering if there is a better way to do this using Perl only.

      open INF, "ST_20120829_102433_AB.txt" ;
      open OUTF, ">outf.txt" ;

      binmode INF;
      binmode OUTF;

      while (read (INF, $readbuff, 65535)) {
      $readbuff =~ s/$t1/,/g ;
      print OUTF $readbuff ;
      close INF ;
      close OUTF ;