title: How can I improve this commify routine for speed?
body: <p>I need an efficient commify filter or routine for use with Template::Toolkit. It is to be used many times on the page. It should support decimals.</p>
  
  <p>This one is found in <a href="http://oreilly.com/catalog/9780596003135" rel="nofollow noreferrer">The Perl Cookbook</a>:</p>
  
  <pre><code>sub commify {
      my $text = reverse $_[0];
      $text =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g;
      return scalar reverse $text;
  }
  </code></pre>
  
  <p>Are there more efficient ways?</p>