Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Optimization for readability and speed (code)

by merlyn (Sage)
on Apr 30, 2001 at 22:17 UTC ( #76690=note: print w/ replies, xml ) Need Help??


in reply to Optimization for readability and speed (code)

Augh! I'd scream if I had to maintain that code!

Write it as mostly a single regular expression. You are using a number of very un-perl-like things. The fact that you have to set $" should be the first clue.

Writing it as a single regular expression will almost certainly speed it up as well. You're making Perl do all the things it hates doing. I know, I've had many chats with Perl. {grin}

-- Randal L. Schwartz, Perl hacker


Comment on Re: Optimization for readability and speed (code)
Re (2): Optimization for readability and speed (discussion)
by deprecated (Priest) on Apr 30, 2001 at 22:24 UTC
    However, the developers who are going to be maintaining code like this are not perl developers and feel that perl is "part of the problem" because the CGI's on the site (which I had no hand in) are misbehaving. It almost reminds me of C code, and I wanted to make sure that others were able to read it. It is readable, if not very perlful, imho.

    dep.

    --
    Laziness, Impatience, Hubris, and Generosity.

      I'm again going to disagree. What you've written is neither C nor Perl, and something kinda awful in between. Perl experts will wince, and C experts will lack the Perl understanding to pick it up.

      Either make it native Perl, or don't write it in Perl.

      It's also broken as Perl. You return from the middle of the subroutine that sets $", but you don't reset it! That breaks the rest of the program. Use this instead (if you must):

      local $" = '';
      Then no matter what exit you take, the caller's value of $" is preserved.

      -- Randal L. Schwartz, Perl hacker

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://76690]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2014-12-27 17:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls