To remove a character from each record in an array, you can use a loop:
tr/\r//d for (@lines);
I'd probably use a chomp while reading lines in, though, depending on your OS. If that's not possible, I'd do the transliteration on each line while reading them in. | [reply] [d/l] |
<sigh> I forgot to add <BR>'s... sorry guys.
Data -->
BAD Format:
"1,123,342,342,
BAD INFO
,342.34,16"
GOOD Format:
"1,123,342,342,GOOD INFO,342.34,16"
In my DATAFILE I am parsing, it seperates each record by \n\n. Within that, each column of Information is seperated by a comma. Everything is parsed perfectly except for a few records which contain a return (CR) and does havoc with the entire output.
| [reply] [d/l] |
Either of these should work.
map { $_ =~ s/\r//g } @array;
or
foreach $item (@array) { $item =~ s/\r//g; }
hope that helps.. It'd probably be best to filter them out on a per line basis when you're creating the datafile(if you have control over it), as opposed to when you're reading it in.
| [reply] [d/l] |