Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: There's Only One Way To Do It

by biosysadmin (Deacon)
on Apr 07, 2004 at 06:29 UTC ( [id://343200]=note: print w/replies, xml ) Need Help??


in reply to There's Only One Way To Do It

While Perl provides an obvious answer for many problems (such as implementing sequences as arrays as you mention), I think that you're right in saying that usage of these idiomatic expressions is highly dependent on their knowledge of the Perl language.

If there's one thing that I learned from teaching a college class in Perl, it's that some people learning Perl can come up with some amazingly creative (and often horridly inefficient) solutions to problems that have already been solved in some animal-themed book. For example, I had one kid who just loved storing sequences of single characters in an array. Something about it just sat right with him. Sometimes it's gotten to the point where I can recognize cheating on a project based on the bizarre idioms that are suddenly transferred from one person to another.

Replies are listed 'Best First'.
Re: Re: There's Only One Way To Do It
by jdporter (Paladin) on Apr 07, 2004 at 15:53 UTC
    I hear ya. I once worked on a project where I inherited some perl code from someone whose knowledge of arrays was limited to the following:
    • Iteration: for $line ( @lines )
    • Read from file: @lines = <FILE>;
    • Write to file: print FILE @lines;
    His code was rife with hacks like
    # add the new item to the list: open TMP, "> $tmp"; print TMP @items; print TMP $new_item; close TMP; open TMP, "< $tmp"; @items = <TMP>; close TMP;
    It baffles and amazes me that someone could know how to read and write arrays to file, but not have learned about the push operator! Also disgusting was the fact that this person didn't know enough to put that snippet in a subroutine. He C&P'd it (and every other hack he ever devised) rampantly throughout his code.

    jdporter
    The 6th Rule of Perl Club is -- There is no Rule #6.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-03-28 14:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found