I've been working with large text data files recently. I do most of my test-bed Perl work on a 10-year-old WinXP PC with 1 GB RAM.
The largest single file I've processed in one gulp was over 85 MB; the old XP handled it. My scripts pull it all in with code like

@TextArray = <TEXTFILE>;

The RegEx substitution you mention should work fine if it can handle a single string that long. I've never tried it that way, so I can't vouch for it.

From what I've been doing, I'd suggest reading in the whole file, as you mentioned, and as indicated above. Then process each line in a foreach loop, copying lines into a separate array if they aren't the multi-line comments you don't want.

You would use a variable, perhaps $IsCommentLine, to start and stop the ommission of lines. Set the variable to true when the "/*" is found, set the variable to false when the "*/" is found. When the variable is false, copy the line into the separate array. When the variable is true, don't copy the line. Everything between the delimiters gets omitted, because the variable is true until the "*/" is found. Like your RegEx idea would do, but line-by-line instead.
Dyslexics Untie !!!

In reply to Re: joining lines efficiency? by JockoHelios
in thread joining lines efficiency? by perlperlperl

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.