Here's an example of what I'm trying to do:
- open a Unix file on Windows (or vise-versa)
- read in the file contents regardless of line-endings (works with lines)
- write back to the file (either write or append), using the SAME line endings that were originally found in the file, as opposed to clobbering the file with the wrong endings
For instance, if I start with a Unix file with one line and a unixy \n on a Windows system, then append to the file, I get one line with a nix ending, and one with a windows ending:
10
10^M
This kind of thing happens in both P5 and P6.
I wrote a module that handles this in Perl 5, File::Edit::Portable. To learn about Perl6, I thought I'd port this module over, but the most fundamental aspect of figuring out what style of endings a file has seems to be a bit difficult in Perl6 :)
Perhaps I should have stated what X was instead of asking about Y (XY Problem) :)
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.