I see you promoting the fairly expensive Tie::File repeatedly

Yes, and just like you, I use dot star, and more inefficient functions. Why? Because sometimes, I just don't care about speed. I am quite sure I won't notice a few milliseconds in execution time, or even a few seconds with larger files (you would need VERY (100 MB+) large files to notice the difference when you're replacing continuation characters). I would however notice the time spent on thinking, if I code it.

Of course, a regex solution is faster. I guess that in this case it will be approximately three times as fast as the Tie::File solution I gave. However, TIMTOWTDI, and slow isn't necessarily bad.

A regex-solution given by me would probably have been something like:

perl -i -pe'BEGIN { undef $/ } s/\n\+//g' filename

without paying much attention to much simpler solutions

Tie::File is new for me, as it is for many other people. I have found it to be very efficient in certain cases, and will continue to use it. To learn to use something, you must use it for real life problems. So I did, and I use this monastery for that. In this case it's not the most efficient method of dealing with the problem, but if we're going to talk about efficiency, I'd like to ask why you repeatedly promote (if that word is appropriate, and I think it is not) CGI.pm, instead of more efficient alternatives. I think it has to do with programming style. To me, style is much more important than efficiency (unless something is done many, many times in a loop). And maybe you think using diamonds, substitution, m//g in list context, and local are "simpler", but I tend to disagree.

Please be aware of the expense of Tie::File.

I am. Constantly, and have been ever since I first saw it.

Yes, I reinvent wheels.


In reply to Re: •Re: Re: Look ahead and join if the line begins with a + by Juerd
in thread Look ahead and join if the line begins with a + by Rhodium

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.