Just another Perl shrine | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Open a file and write "\n" to it.
Re-open the file and use binmode, then read it back in. The result is the desired string.
Something like this... If you don't have a writable file (why not a valid temp directory??!) use a filehandle tied to a text buffer. Say, IO::Scalar. Hmm, I tried that and it didn't work, as I half-suspected. The binmode thing is done in the C Standard library functions, and Perl might be relying on that and have no real knowledge of what it means on a given platform. Are you sure you can't come up with a writable file, or a fake file that operates on the FD level rather than Perl's tie level? —John In reply to Re: Quick and portable way to determine line-ending string?
by John M. Dlugosz
|
|