Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

PerlMonks has changed me

by kwaping (Priest)
on Aug 30, 2005 at 21:24 UTC ( [id://487951]=perlmeditation: print w/replies, xml ) Need Help??

(Forgive me if this is too common of a topic.)

I've noticed that being an active member of PerlMonks has changed my coding style. I now use warnings instead of using #!/usr/bin/perl -w. I also find myself using map more. I'm even trying to stop using exit at the end of my programs, though that's a tough habit to break.

How have your coding habits changed? Maybe I can adopt some of those too!

Replies are listed 'Best First'.
Re: PerlMonks has changed me
by GrandFather (Saint) on Aug 31, 2005 at 04:20 UTC

    More ways than I could count or remember. But areas where I've learned a lot are:

    • regex's - especially look ahead and behind
    • general awareness of modules that are available
    • tools like Data::Dumper and Benchmark
    • editing raw HTML - from writing nodes :)
    • ...

    Perl is Huffman encoded by design.
      editing raw HTML - from writing nodes :)
      Mmh. But you still forget to close your <li>-tags ;-)


      holli, /regexed monk/

        Rats. I used <li/> tags, but they got changed to unclosed <li> tags. Obviously can't use that trick. Ah well, there's something else I learned from PM :)


        Perl is Huffman encoded by design.
      Ah yes, I completely forgot to mention Data::Dumper! That's one of mine too. I really need to explore look-ahead and -behind regexes as well.

        Ill toot my own horn and point out Data::Dump::Streamer as well. Its basically a replacement for Data::Dumper but with mor accuracy, finer control and cleaner output. If you have a C compiler available (ie you need to be able to build XS) then you should at least give it a go. Be sure to arrange that the DDS shortcut module is installed. (by running perl makefile.pl DDS).

        Why this is relevent to the thread is that PM changed me from someone who could only use and admire Data::Dumper to someone who can and has written something similar and maybe in some ways even better. Thats a lot to learn :-)

        ---
        $world=~s/war/peace/g

Re: PerlMonks has changed me
by g0n (Priest) on Aug 31, 2005 at 12:11 UTC
    I'm not really a programmer, and perlmonks has introduced me to a lot of very smart programmers and the "programmerly" techniques they use, things that have made my code better, more reliable and easier to write, like:

    • automated testing (with Test)
    • test coverage (with Devel::Coverage)
    • code profiling (with Devel::DProf)
    • object inheritance (understood the concept, learned how to use it in perl right here).

    --------------------------------------------------------------

    g0n, backpropagated monk

Re: PerlMonks has changed me
by polypompholyx (Chaplain) on Aug 31, 2005 at 12:02 UTC

    Using this:

    open my $FH, '<', $file or die "Can't open '$file' for reading: $!\n";

    instead of this:

    open FH, $file;

    The real revelation was lexical filehandles: I'd been happily localising typeglobs for years, but I somehow managed to miss lexical filehandles when 5.6.0 came out, and didn't realise they existed until seeing them in a node on here about six months ago...

Re: PerlMonks has changed me
by jacques (Priest) on Aug 30, 2005 at 22:56 UTC
    There's nothing wrong with using the -w flag. It's useful when you don't want warnings lexically scoped. Just know the difference.

      Unfortunately, it also exposes some of your library provider's bad coding habits (warnings galore).

      --MidLifeXis

Re: PerlMonks has changed me
by tlm (Prior) on Aug 31, 2005 at 11:51 UTC

    Lately I've noticed that whenever I read something online that I very much like (or dislike) I find myself looking for the "vote buttons". A clear case of acute perlmonkitis. :-)

    More seriously, PM has changed me as a programmer in a million ways, but none of them stand out in particular above the others. Just by being able to discuss a subject with people who know it well (or listening in their dialogues) one picks up a lot of good information. I find reading people's code illuminating often in ways entirely unrelated to the topic being discussed.

    the lowliest monk

How PerlMonks has changed me
by Ovid (Cardinal) on Aug 31, 2005 at 19:34 UTC

    Prior to coming to Perl, I was paid to code in a variety of languages/tools: COBOL, EasyTrieve, Focus, UniBasic, JCL and VBA. Compared to other programmers I got my work done fast and thought I was good. Then I ran into Perl. I was amazed at how much faster I could get things done.

    In coming to Perlmonks, rather than just teaching me how to solve a particular problem, Monks took the time to introduce me to computer science, something I previously had ignored. I started learning about stacks, queues, hash tables, O(n) notation, profiling, testing, etc. I'm at the point now where I've actually implemented a programming language (AI::Prolog) in Perl. The Perl community, and Perlmonks in particular, has taught me not just how to hack, but how to analyze and build systems. I wouldn't be where I am in my career today were it not for the patient and helpful people I have found here. Heck, it even got me a job in Amsterdam at one point :)

    That, incidentally, is why I volunteer time for the Perl Foundation. It's my attempt to repay everyone for what they've given me. I don't always say it, but I'm very grateful to the Perl community.

    Cheers,
    Ovid

    New address of my CGI Course.

Re: PerlMonks has changed me
by danmcb (Monk) on Aug 31, 2005 at 07:38 UTC
    the "how do you debug" thread got me to go give the debugger a retry. Til now I was just using print/Dumper. It's really worth it. You can do all basic debugging with w, x, p, b, c commands. Neat. Also have discovered a heap of modules which will probably bear fruit later - catalyst being the most interesting.
Re: PerlMonks has changed me
by SamCG (Hermit) on Aug 31, 2005 at 16:58 UTC
    I've had "use strict;" pounded into me enough times so that I really try to use it (except in some very short scripts). I also segregate my code a lot more, though I'm not sure if this is perlmonk's influence or just my own experience.

    I guess the biggest thing is that perlmonks is my first source of perl information after the manpages. It's never let me down, and nearly every time I ask a question I get introduced to whole new realms of techniques. Perlmonks: worth the money.
Re: PerlMonks has changed me
by blazar (Canon) on Sep 01, 2005 at 12:46 UTC
    My first contact with some sort of Perl community was through clpmisc rather than through PM. With this relatively small difference (s/PM/clpmisc/g - there are even contributors common to both!), I can support all of what I could read so far in other people's answers.

    My coding style has not changed much since my arrival to the monastery. But of course you keep learning new things, even if at a most definitely slower pace if compared to the beginnings, when my coding style was literally forged by the good suggestions I got from more experienced Perl programmers; and every now and again real pe(a)rls pop out.

    One that springs to mind immediately is something that I learned just yesterday, i.e. that perl not only "optimizes" (see Re^6: A refactoring trap, thanks to adrianh)

    while (<$fh>) { ... }
    which I knew, but also
    while (my $line=<$fh>) { ... }
    as well, which I ignored.

    Also, (possibly) due to the fact my production of short utilities and quick hacks outnumbers "big projects", I've never really been much proficient in OO Perl programming, if you exclude the most basic concepts and techniques, whereas I keep reading interesting articles here about these topics, and I'm positive that my coding style may be positively influenced by them, as I slowly keep on reading them and learning...

Re: PerlMonks has changed me
by beppu (Hermit) on Sep 05, 2005 at 07:34 UTC
    What's wrong with using exit at the end of a program? (How else am I supposed to return an exit code?)
      It's great if you use it wisely, like in a situation like that. However, I was using it blindly, putting exit at the end of every program, whether I wanted (or checked) the return code or not.

      That was mostly an inside-ish joke between me and [id://blazar]. We had a bit of a discussion about that in a previous node. :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://487951]
Approved by kirbyk
Front-paged by planetscape
help
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found