> MIME uses an idea that is kinda neat and could help here.
> [...]

Oh, that's very cute! I can think of a couple of ways of implementing it; in fact, if the data isn't too big, you could say something like this (untested, but the intent should be obvious):

$delim = '!@#$'; # Test for both the 'tag' and the '/tag' varsion $delim .= chr(rand(95) + 33) while $data =~ m{/?$delim}s;
> Your concern there appears to be one of speed of 
> execution. You might reconsider this concern (or at 
> least test it), as running the long mangling process 
> several times on short strings could certainly end up 
> not being much slower than running it once on the much 
> longer full string.

[blink] Yes. The latter was exactly what I was saying, so we're in violent agreement. :) That's why I'm trying to come up with code that will let me do that.

I actually ran a test even before posting here - I'm quite aware that "efficiency is the hobgoblin of little minds". The speed of execution, for what was admittedly a rather large mail archive, went from about two seconds (using a script without this routine) to several minutes (I killed it after about two and a half; no, it wasn't stuck in a loop.) Tagging, removing, processing (once), and replacing - less than three seconds.

Perhaps the way that I had written the new routine was at fault - I'm not sure - but I am sure that running my "mangling" routine more than once is quite expensive.


In reply to Re^2: Anchors, bleh :( (escape) by oko1
in thread Anchors, bleh :( by oko1

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.