Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Newlines: reading files that were created on other platforms

by periapt (Hermit)
on Feb 02, 2005 at 15:00 UTC ( #427278=note: print w/ replies, xml ) Need Help??


in reply to Newlines: reading files that were created on other platforms

Preprocessing input files is not something to be afraid of. Of course, it depends on the flow of your data but it is sometimes more efficient to split the job into two distinct, simpler parts than to try and code one more complex solution.

It seems as if you have a (approximately) a set of client system running something like a data entry or data processing system. You are taking the results from these client systems and loading/processing them into some master program. Even if you are just swapping files among systems, a preprocessing step could be very helpful (your milage may vary). The benefit is that, at a certain point in the flow of data, the data will all look exactly the same regardless of originating/destination platform. That can greatly simplify further processing downstream of that point.

Its worth looking at more closely.


PJ
use strict; use warnings; use diagnostics;


Comment on Re: Newlines: reading files that were created on other platforms
Re^2: Newlines: reading files that were created on other platforms
by Drgan (Beadle) on Feb 02, 2005 at 17:17 UTC

    I'll have to agree with PJ and adamk here. Checking for each type of newline ending would be horrible, but in a pre-processing situation it might actually speed up the processing time. Another suggestion, not that I'm aware of how the input file is obtained, in the creation of the input file, use a specific newline of your choice to make it uniform and use an output method that would determine what to use when the program is running.

    I.E. Program 1 or Section 1 of program takes user input, uses \015 as a standard newline, instead of a system specific newline and creates the input file with that format. Upon use of the input file, the program then spits out system specific newline for "display" of the file.

    "I have said, Ye are gods; and all of you are children of the most High." - Psalms 82:6

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://427278]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2014-10-22 02:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (112 votes), past polls