Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Unusual (and pointless?) idiom in old code

by chrestomanci (Priest)
on Sep 22, 2011 at 11:52 UTC ( #927336=note: print w/ replies, xml ) Need Help??


in reply to Unusual (and pointless?) idiom in old code

Do you know the author of the code you are trying to maintain? Do you have an estimate of their abilities as a perl programmer? What other languages did they code in?

The reason I ask is because you often find strange idioms in perl scripts written by people who are used to writing in shell, C or another language, and because TIMTOWTDI and perl is tolerant of these idioms it works and the programmer leaves them in and gets used to writing their code that way. (For example, see node 927269 where the author looks to be used to writing C.)

Perhaps your predecessor just did not know that you could clear an array with @foo = () and instead started using splice because they where familiar with it from JavaScript or whatever, and then got into the habit of doing it that way and never bothered to learn a better way. A lot of people learn just enough perl to hack something together that works, but don't bother learning anything more because their main job is something else.


Comment on Re: Unusual (and pointless?) idiom in old code
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2014-07-10 02:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (198 votes), past polls