Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: I wrote some clever code - can the comment "defuse" it?

by ChemBoy (Priest)
on Jun 18, 2003 at 05:27 UTC ( #266733=note: print w/ replies, xml ) Need Help??


in reply to I wrote some clever code - can the comment "defuse" it?

I think the various viewpoints on your original question have all been covered adequately already, so I'm going to launch onto a slightly random tangent instead—is there a particular reason why  /\G(X|D+|L+)/g is preferable to the slightly less punctuated /X|D+|L+/g in this situation?

I might also have chosen to use a strategically placed local $, = ""; and "@property{@letter}" =~ // rather than a join, but I'm not going to ask why you didn't do that, since I admit that it probably falls well over the line into "too clever by half" territory. :-)



If God had meant us to fly, he would *never* have given us the railroads.
    --Michael Flanders


Comment on Re: I wrote some clever code - can the comment "defuse" it?
Select or Download Code
Replies are listed 'Best First'.
Re^2: I wrote some clever code - can the comment "defuse" it?
by Aristotle (Chancellor) on Jun 18, 2003 at 09:41 UTC

    I opted for this particular regex as a minor safety net. If any value in %property is ever something else than L, D, or X, the regex will fail at that point. That's just a smidgen better than letting the regex skip those silently, causing the splice to pull together the wrong things.

    The latter would be too clever by a half indeed; the join is very clear in my mind, and if I wanted to make it more explicit, I'd use another temporary scalar at that point instead.

    Makeshifts last the longest.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (20)
As of 2015-07-28 13:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (255 votes), past polls