http://qs321.pair.com?node_id=442040


in reply to Re: Sort on Number Embedded in String
in thread Sort on Number Embedded in String

I think in a case like this, it depends on what the code is meant for. If it's just to play around and to find a faster solution for yourself, using the Schwartzian Transform might be a nice idea. But if it's for a production environment, your code (IMHO) might be better suited since it is more clear. In this case, the comparison is cheap enough to warrant wasting more cycles in favour of readability.

Remember, there will always be a programmer after you who has to read your code. And only in an ideal world is (s)he familiar with advanced Perl techniques.