I am having to replace the pipe character with a space in every instance it occurs in a file so that I can manipulate it using other 3rd party programs.
This is my code, and it has worked in several other places where I've had to replace characters, but replacing the pipe makes it insert a space after every single character
sub fixspace{
$rem ="|";
$rep = " ";
open FILE, "<$file";
open OUTP, ">c:\\joshperl\\deptemp.txt";
while (<FILE>)
{
s/$rem/$rep/go;
print OUTP;
}
close FILE;
close OUTP;
}
my data looks like this originally
|03/17/03|2314|0x53('S')|03/17/03|03/19/03|0.00|0.00|133712.00|133712.00|123456433|431234533|412345901|82|3.00|
and comes out like this
| 0 3 / 1 4 / 0 3 | 2 2 0 7 | 0 x 4 E ( ' N ' ) | 0 3 / 1 7 / 0 3 | 0 3 / 1 7 / 0 3 | 0 . 0 0 | 0 . 0 0 | 8 0 3 6 0 . 0 0 | 8 0 3 6 0 . 0 0 | 1 3 4 5 6 7 8 9 9 | 3 4 5 6 7 7 7 5 8 | 3 4 5 6 7 9 6 6 3 | 9 1 | 1 . 0 0 |
Don't worry about the values of the fields, I had to pull from different files and mess with the numbers to keep all our info locked away in a vault somewhere.