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

How 'n' why

by KeithMarr (Initiate)
on Jun 01, 2000 at 00:03 UTC ( #15694=perlquestion: print w/replies, xml ) Need Help??

KeithMarr has asked for the wisdom of the Perl Monks concerning the following question:

I know that "There's more than one way to do it" 'cause i've bin doin it for almost 25 years in Fortran, Basic, C and C++, the only thing that escapes me for the moment is how you guys ('n' gals if their 'R' any out there) manage to make it look all so elegant what with your ' do this if that ' and 'foreach while $this 'n' $that' if %hash is <> @array $something'. Don't get me wrong, I use Perl ever day, but where do I learn to do it well?????????????????

Replies are listed 'Best First'.
RE: How 'n' why
by neshura (Chaplain) on Jun 01, 2000 at 00:11 UTC
    Seems to me you are at a bit of a disadvantage -- I learned C first, but I did so little with it that I didn't get any ingrained habits. Perl is my first in-depth language, and I learn everything by looking at better code, better coders. If merlyn posts some code, I mentally dissect and store it away. My code has gotten lots better -- more concise, but still stylistically intact. Just read and do -- same with all languages. (Just so you know, someone laughed at my code once and said "You're a C coder, aren't you?" -- I thought it was pretty funny actually...)

    e-mail neshura

Re: How 'n' why
by perlcgi (Hermit) on Jun 01, 2000 at 00:16 UTC
Re: How 'n' why
by lhoward (Vicar) on Jun 01, 2000 at 00:14 UTC
    I hate to sound like I'm plugging another Perlmonks member, but check out Effective Perl Programming by Joseph N. Hall and Randal L. Schwartz (merlyn). It really helped me refine my perl technique. There is even a chapter called "Idiomatic Perl" which will have you using @_ with confidence in no time.
Re: How 'n' why
by infoninja (Friar) on Jun 01, 2000 at 01:06 UTC
    I'd also reccomend Perl Cookbook. It's a great reference, and I've also gained a lot of perl knowledge by just sitting down and reading it, which typically results in me saying "Aha! So that's how you do x in Perl."
Re: How 'n' why
by Maclir (Curate) on Jun 01, 2000 at 02:22 UTC
    I am like yourself - my first real program was written in Fortran, using punched cards for a Control Data mainframe, some 25 years ago. As far as books go, I have the Camel book (Programming Perl) and the Perl Cookbook. Based on other comments, I will also get Effective Perl Programming.

    Other suggestions - look at people's code, read whatever you can, look at the writings of the truly expert (like Randall's Web Techniques Column).

    Ken

RE: How 'n' why
by flyfishin (Monk) on Jun 01, 2000 at 18:37 UTC
Re: How 'n' why
by KM (Priest) on Jun 01, 2000 at 01:12 UTC
    Folks mentioned some good books. I will add Mastering Regular Expressions (ORA), Object Oriented Perl Programming (Manning), and Mastering Algorythms in Perl (if you like algorythms). Also, there will be new versions of Learning Perl and Programming Perl comming out this year. Oh, and don't forget to subscribe to The Perl Journal!

    Cheers,
    KM

Re: How 'n' why
by takshaka (Friar) on Jun 01, 2000 at 03:45 UTC
    Lurk in comp.lang.perl.misc.
RE: How 'n' why
by flyfishin (Monk) on Jun 01, 2000 at 16:23 UTC
    All of the above suggestions are great. One that I will add is to write code, trash it, and rewrite it. I have seen this suggested in many places. When you rewrite it take the time to look up a new function or use a different module.
Re: How 'n' why
by Bourgeois_Rage (Beadle) on Jun 01, 2000 at 19:20 UTC
    We here at Perl Monks like to think it's Divine intervention.
Re: How 'n' why
by KeithMarr (Initiate) on Jun 03, 2000 at 00:21 UTC
    Would certainly like to thank all those who have taken time out of their busy lives to respond to my question and I will definitely a) reflect on the abstract b) react to the concrete as I apparently have miles of code to read before I sleep! Thanx mas.
Re: How 'n' why
by Buckaroo Buddha (Scribe) on Jun 01, 2000 at 01:38 UTC
    
    you think you're at a disadvantage because you've 
    got all these bad habbits?  
    
    try and learn PERL when it's the only thing you know
    i have first-year (university) C++, and FY: SmallTalk 
    (now smalltalk is a language i LOVE <g> ) 
    
    you'd be amazed at how many examples are written as:
    " x in C++ is written as y in PERL"
    
    aside from basic logic process, trivial knowledge 
    of what an array and a dictionary are PERL is 
    essentially the only language i know
    
    i can't wait to learn what the heck a regexp (sp?) is
    i can't wait to learn what a DLL is (apart from a 
    file that crashes all the time)
    
    GUI and graphics (GTK) are so mysterious to me that i 
    get butterflies thinking about the day when i write 
    one in PERL (or is that too much coffee?)
    
     ... that's why i'm asking so many silly questions 
    here (read some of my writeups, you'll see)
    
    i do hope that some of the answers and problems i work
    through (with the help i find here) can help another
    wannabe-JAPH
    
    i find that these ultra-simple problems are completely
    undocumented on the web ... it'll be great to have 
    that for PERL one day
    
    a knowledge base of everything from beginner
    to advanced
    
    
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2021-03-03 05:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (73 votes). Check out past polls.

    Notices?