#!/usr/bin/perl
use warnings;
use strict;
######################################################################
+########
open FH, "<:encoding(UTF-16)", "$file_folder\\$ori_datafile" or die
+ "can't open file";
...
#open (NEWFILE, ">$file_folder\\$new_datafile") or die "can't open fil
+e";
open (NEWFILE, ">:encoding(UTF-16)","$file_folder\\$new_datafile") or
+die "can't open file";
open (FIXLOG, ">$log_folder\\$fix_log") or die "can't open file";
open (ERRLOG, ">$log_folder\\$error_log") or die "can't open file";
open (FIXRPT, ">$log_folder\\$rptfile") or die "can't open file";
It is usually a good idea to include the $! or $^E variable in your error message so that you know why open failed.
chop; # aviod \n in last field;
Most modern Perl programs use chomp instead of chop.
$ori_line_number=$ori_line_number+1;
That is usually written as:
$ori_line_number += 1;
Or simply:
$ori_line_number++;
$pipe_thisline=($_ =~ tr/\|/\|/);
tr/// does not interpolate so the back-slashes are not necessary. Also, if the replacement character list is the same as the search character list then the replacement character list can be omitted, and the default binding is to the $_ variable so that can be omitted as well, so:
$pipe_thisline = tr/|//;
if ($pipe_thisline eq $right_pipes) {
...
if ( $pipe_thisline > $right_pipes ) {
Are $pipe_thisline and $right_pipes numeric or text, because you are using numeric comparison in one place and text comparison in another.
if ($ori_line_number eq 1) { print FIXRPT "Report on Fixing Line Bre
+aks in CT_Vendor_Summary File\n\n";
...
else { if ($pipe_sum eq 0 ) {
...
elsif ($pipe_sum eq $right_pipes ) {
Why are you using text comparison on numeric values?
|