Thank you, AnomalousMonk, for your very useful input.

Yes, looking at it retrospectively, I clearly realize that it was a bit silly on my part to try to pass a function invocation, rather than a simple code reference, to the benchmark module. I am definitely not proud of that stupid error, but I thought it might be useful to others for me to explain what I originally did wrong. I wrote a couple of tutorials in French on some specific uses of Perl, and, in them, I am quite often proposing an initial wrong answer before giving out the right one, as I think trying something wrong is at least as useful as getting the right one from the start. Your explanation on my original error serves the same purpose, thank you for that (and, let me be clear on that, I am not trying to claim that it will be useful to others only, my description of my original error was hopefully for the others' benefit, your explanation is useful to others, I think, AND to me as well).

My only excuse, if any, is that it was very late at night and I was tired, so that my ideas were a little bit blurred by tiredness (not to mention the couple of wine glasses I had earlier for a small celebration at my photo club). Then, as I already said, I was in a bit of a hurry to try to get the results I was looking for and wrapping the invocation in a sub {} construct was the fastest solution I found to get a clean compile and usable results. Thank you again for the time you took on this post, as well as on your earlier post on the same topic. Cheers.


In reply to Re^5: Performance problems on splitting long strings by Laurent_R
in thread Performance problems on splitting long strings by Laurent_R

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.