Try this (updated to reflect the error toolic caught below)(Further updated to correct flaws reported by dualafn):

sub substitute{ my $s = shift; $s =~ s[\{\\d(\d+)\}][ substr int( 1e10 + rand 1e10 ), 1, $1 ]ge; return $s };; print substitute( $_ ) for 'A message {d3} of {d4}';; A message 425 of 3404 print substitute( $_ ) for 'A message {d3} of {d4}';; A message 860 of 3797 print substitute( $_ ) for 'A message {d3} of {d4}';; A message 453 of 2262 print substitute( $_ ) for 'A message {d3} of {d4}';; A message 761 of 5898 print substitute( $_ ) for 'A message {d3} of {d4}';; A message 321 of 4182 print substitute( $_ ) for 'A message {d3} of {d4}';; A message 924 of 5054
[14:37:57.99] C:\test>junk Rate nar_func mca_func toolic_func buk_func nar_func 2449/s -- -26% -66% -78% mca_func 3287/s 34% -- -55% -70% toolic_func 7231/s 195% 120% -- -35% buk_func 11125/s 354% 238% 54% --

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re: Speed Improvement (Updated!) by BrowserUk
in thread Speed Improvement by Nar

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.