[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Writing line-ending agnostic scripts?



Michael Schuerig <uzs90z@ibm.rhrz.uni-bonn.de> writes:
}It's night of the living dead again...
}
}Apart from converting line-endings before stuffing files into MacPerl is
}there a way of writing scripts in a way that they recognize all the common
}line-endings as what they are intended?
}

Are you talking about the scripts or text files read by the scripts?  If
you're talking about Perl scripts themselves, the answer is no.  MacPerl
wants Mac text, Unix Perl wants Unix text (I just checked), etc.  Text data
files of any format are trivial to deal with using $/.  If you don't know
beforehand what kind of text a file is, you can always read in a chunk with
read() or sysread(). count the numbers of \015's and \012's, and proceed
accordingly.

}Michael
}
}

---
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693, Greenbelt, MD 20771
schinder@pjstoaster.pg.md.us



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch