Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Can we do without auxiliary variable here?

by sundialsvc4 (Abbot)
on Feb 28, 2011 at 20:52 UTC ( [id://890641]=note: print w/replies, xml ) Need Help??


in reply to Can we do without auxiliary variable here?

Being an old crotchety person by now, I take the Clark Gable Approach™ to such things:   “Frankly, my dear, I don’t give a damn”™ about how you write it, as long as what you write is abundantly clear.   The original version of this code was, indeed, clear.   (Therefore:   priceless.)   Save the rest for “Obfuscation” and “Poetry.”

Q:   Can we do without an auxiliary variable here?
A:   Clark Gable.™

Replies are listed 'Best First'.
Re^2: Can we do without auxiliary variable here?
by afoken (Chancellor) on Mar 01, 2011 at 06:47 UTC

    Right. The only reason to change clear code I see is a massive performance problem in the respective code, typically shown by running a profiler. Everything else is premature optimization and thus evilTM.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
Re^2: Can we do without auxiliary variable here?
by rovf (Priest) on Mar 01, 2011 at 11:37 UTC
    This is an interesting aspect, because in the end, I found ikegami's solution using map in combination with /^/ easier to understand than my original one, once I understood it. Before this, I was not aware that matching on /^/ could make sense (Perl's universe of regular expression exceeds my current knowledge by far). Probably that's typical for readability questions: Readability depends also very much on the experience of the reader...

    -- 
    Ronald Fischer <ynnor@mm.st>

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-24 08:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found