I am calling the following cgi program from a webpage to Upload a File and Convert the tab Separation to Comma only if the Format is 6 or 7. The following program seems to work when i run it from Unix but it fails when i call from the webpage
#!/usr/local/bin/perl
$format=$query->param("P_FORMAT");
$SAVE_DIRECTORY="/u03/test/upload_files";
if ($query->param("file_01") =~ /([^\/\\]+)$/) {
$Filename = $1;
$File_Handle = $query->param("file_01");
}
$BytesRead = 0;
$Buffer = "";
if ($format =~ /6/ || $format =~ /7/) {
$rmFile= $SAVE_DIRECTORY . "/" . $Filename . ".bak";
system "rm -rf $rmFile";
$Convrsn="'s/\t/,/g'";
system "perl -pi.bak -e $Convrsn $SAVE_DIRECTORY\/$Filename";
if ($format =~ /6/) {$format = "1";}
if ($format =~ /7/) {$format = "5";}
}
printf("$format\n");

#!/usr/local/bin/perl
$format=$query->param("P_FORMAT");
$SAVE_DIRECTORY="/u03/test/upload_files";
if ($query->param("file_01") =~ /([^\/\\]+)$/) {
$Filename = $1;
$File_Handle = $query->param("file_01");
}
$BytesRead = 0;
$Buffer = "";
if ($format =~ /6/ || $format =~ /7/) {
$rmFile= $SAVE_DIRECTORY . "/" . $Filename . ".bak";
system "rm -rf $rmFile";
$Convrsn="'s/\t/,/g'";
system "perl -pi.bak -e $Convrsn $SAVE_DIRECTORY\/$Filename";
if ($format =~ /6/) {$format = "1";}
if ($format =~ /7/) {$format = "5";}
}
printf("$format\n");