Hi,
I have tried your suggestion and it does not solve the problem
I have compared the format of the output of this with the
format of a file that has no carriage return and the
formats are identical
use FileCache maxOpen => 50; # config: my $field = 0; my $sep = ","; $, = $sep; $\ = $/; my %file; my $fnum = 1; my $outDir = $ARGV[1]; unless (-d $outDir){ die "There is a no such directory."; } open PROCESSEDFILE, $ARGV[0] or die $!; while (<PROCESSEDFILE>) { chomp; my @c = split(/$sep/,$_); my( $key, $num ) = defined $c[$field] ? ( $c[$field], $fnum++ ) : ( '(column not present)', 0 ); unless ( $file{$key}) { $nameF = $c[$field]; $nameF =~ s/"//g; $file{$key}{num} = $num; $file{$key}{name} = $ARGV[1].$nameF.$end; if(($file{$key}{num}) >1){ -f $file{$key}{name} and die "Sorry, '$file{$key}{name}' exists; won't clobber."; $file{$key}{fh} = cacheout $file{$key}{name} or die "Error opening '$file{$key}{name}' for write - $!"; }} print {$file{$key}{name}} @c; }
This is the code for the next part of the processing.
The output of this is okay for files that are not preprocessed.
When I use a preprocessed file as input to this. It will
process the records that had the carriage return ok but it doesn't process records that where formatted properly in
the original file
I am thinking that there is some character that I am inserting
when processing the records that have \r\n and leaving it out
when writing the records that don't have these
but I can't spot it.

In reply to Re^2: Reading Multiple lines by mick2020
in thread Reading Multiple lines by mick2020

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.