in reply to Re^4: The indisputable speed of tr///
in thread The indisputable speed of tr///

The string eval is an interesting solution, (snip)... unfortunately, it won't be allowed in prod ...

There is nothing wrong with string eval when you have complete control over what's going into it, and there's no real speed issue if it's a 'do once' thing where you use the results many times, and it sounds like that's how you will use it. And it's the only way to dynamically get things into tr/// so you can initialize it from, e.g., a hash, instead of hardcoding the tr/// translations (except as Jenda notes above, by generating the script itself, which is essentially the same thing as an eval anyway).

Replies are listed 'Best First'.
Re^6: The indisputable speed of tr///
by radiantmatrix (Parson) on Jun 28, 2006 at 14:04 UTC

    There is nothing wrong with string eval when you have complete control over what's going into it,

    Oh, I agree with you. I also happen to agree with our coding standards, because far too many people with Perl on their resume are incompetent fools whose experience with Perl stops at making a config change to one of Matt's Scripts. Had I not already put carefully-crafted char classes into prod, I'm sure I could make a case for an exception (they do grant them after a business approval and a code review, which is quite reasonable).

    <radiant.matrix>
    A collection of thoughts and links from the minds of geeks
    The Code that can be seen is not the true Code
    I haven't found a problem yet that can't be solved by a well-placed trebuchet