Gossamer Forum
Home : General : Perl Programming :

Unicode File manipulation - Pls Help

Quote Reply
Unicode File manipulation - Pls Help
I am new to perl. Please help me convert the Tab delimiter in a UNICODE file to comma delimiter(Is the following Code correct).

Also there is some "\377\376" added to the beginning of the Unicode File(Dont know from where it sis coming) how to remove that character from the file?

#!/usr/local/bin/perl
$SAVE_DIRECTORY="/u03/upld_files";
$Filename="Diacrit.txt";
$format="7";
printf("$format\n");

$outputf = "$SAVE_DIRECTORY\/$Filename";
if ($format =~ /6/ || $format =~ /7/) {
$rmFile= $SAVE_DIRECTORY . "/" . $Filename . ".bak";
system "rm -rf $rmFile";
open(SUB, "$outputf") || die "Cannot open file $!";
while (<SUB>) {
$_ =~ 's/\t/,/g';}
close(SUB);
if ($format == 6) {$format = "1";}
if ($format == 7) {$format = "5";}
}