Andrew Gaffney <[EMAIL PROTECTED]> wrtoe:
: : I managed to get Word to export it into a format where
: the fields are separated by '\r'. Yeah, kinda weird. I
: wrote the following:
: : open FILE, $file;
: my $counter = 0;
: : while (<FILE>) {
: while (/\r?([^\r]*)/sgc) {
: $counter++;
: if($counter == 10) {
: print "\n\n";
: $counter = 1;
: }
: my $temp = $1;
: $temp =~ s/\n/~~~/sg;
: $temp =~ s/\"//g;
: $temp =~ s/\'/\\'/g;
: print " $temp ";
: }
: }
: : This should print the contents of each field as it
: reads it, which it does seem to be doing. The only
: problem is that it seems to be printing "\n\n"
: after only 7 fields. Also, will that regex get
: everything I want it to? I need to capture
: everything between each set of '\r' including the
: first field which only has a trailing '\r'.
Can you provicde some test data?
No, I can't. The data I'm working with is a lawyer's client list. I figured it out anyway. There were embedded '\r\n' in some of the field. My program was interpreting this as 2 more fields, one with a '\n'. I just wrote a regex to filter any occurences of '\r\n' and the problem went away.
-- Andrew Gaffney Network Administrator Skyline Aeronautics, LLC. 636-357-1548
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>