Code:
open(FH_TMP,"<","$chk_file");
open(OUT,">>",tmpfile);
while (my $line = <FH_TMP>)
{
$line =~ s/ {2,}/|/g;
print OUT $line;
}
close(FH_TMP);
close(OUT);
could be done faster using perls inplace editor:
Code:
@ARGV = ($chk_file);
$^I = '.bak';
while (<>){
s/ {2,}/|/g;
print;
}
will cretae a backup of the original file first. (.bak extension)