<br><br><div class="gmail_quote">On Sun, Mar 6, 2011 at 8:21 AM, Adam Morris <span dir="ltr"><<a href="mailto:adam.morris@redstargaming.net">adam.morris@redstargaming.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div style="word-wrap:break-word"><div><div></div><div class="h5"><div><div>On Mar 6, 2011, at 0:07 , Robert Nesius wrote:</div><br><blockquote type="cite"><br><br><div class="gmail_quote">On Sun, Mar 6, 2011 at 12:01 AM, r j <span dir="ltr"><<a href="mailto:ronsmailbox5@gmail.com" target="_blank">ronsmailbox5@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">
I am really enjoying learning Perl right now and I love the array and list operators.<br>After using python for a while I am finding its not so hard to say there is more than one way to do it.<br>The ease in making a list of elements is cool (1...100);<br>
and using @ to make a list @giant = 1...1e5;<br>The generate word list it nice as well gw< this list of words ><br>Cool :D<br>What are some of your favourite language elements to get work done ?<br>,Ron <br><br></blockquote>
<div><br>Hi Ron, <br><br>On the one hand I applaud your ability to step outside of Python and appreciate something different. On the other hand here's what a friend of mine had to say about Perl after developing in it for 10+ years and then finally moving to Python. <br>
<br>"Ten years of Perl man. That shit rots your brain." <br><br>As someone who also spent 10 years+ maintaining perl distros and debuggin legacy perl scripts, I have no option but to agree. <br><br>Enjoy your time with Perl, but .... don't deploy anything into production if you don't have to. Those who come after you and maintain your code will thank you for it. <br>
<br>-Rob (who is migrating from Perl to Ruby, with an eye on Python as a possible end-game beyond Ruby). <br></div></div></blockquote></div><br></div></div><div>As someone who writes production both Perl and Python code professionally (10+ years), this is one of the biggest things I see and disagree with on a normal basis. You <i>can</i> make very clean looking Perl code. Perl Tidy helps with this a lot, and forcing people to use a post-modern object system like Moose provides helps even more. Add in a requirement that everyone runs perltidy and perlcritic before they perform a check-in and you've got some code that you can show to Mom. I've actually seen cleaner Perl code than Python code on a frequent basis.</div>
<div><br></div><div>That said, Perl makes it a <b>lot</b> easier to make really ugly looking code. There are many Perl programmers I've met over the years who seem to think they know more than Chronic and Conway when it comes to best practices and that's both frustrating and unprofessional. In my experiences Legacy code is riddled with this, but running it through perltidy usually helps when you've got to maintain something.</div>
</div></blockquote><div><br><br>Adam nailed it, and everything he said is true. There is a bit of subjectivity here, but really it comes down to how you look at it. Adam looks at the above points - and concludes "Perl's a reasonable language to work in." For some people that's true, but I think those preconditions he listed point to a lot of risk. <br>
* Everyone runs perltidy. <br>* Everyone runs perlcritic<br>* Warnings on? <br>* Use strict on? <br>* Do you know the idiomatic best practices? <br><br>Add to that some other considerations... <br>* Object oriented functionality was bolted onto perl after the fact<br>
* Scalar vs. array-context considerations can cause a lot of unexpected things to happen <br>* I never enjoyed de-referencing pointers in perl. <br><br>Anyway, take all of the above and Andy is saying "See. You can get there." And my point is "Look at everything you need to do to get there. While you can write atrocious code in Ruby or Python, it's not as easy to do as it is in Perl, and conversely it takes more effort in Perl to get to elegant, clean code." That's really what it boils down to for me.<br>
<br>My (possibly incorrect) view of Ruby and Python is they are refactorings of Perl. Both languages stepped back to the language design phase and tried to make a better dynamically typed interpreted language with object-oriented programming paradigms integrated from the ground up and I think they both are improvements. <br>
<br>When I first started going to OSCON back when it was still the "Recently Renamed Perl Conference", Perl ruled the day. There were 15 bajillion books on perl, and nearly all of the conference talks about "cool stuff I did" were perl modules. On top of that Damien Conway is not just a "God of Perl", he's a "God of Presentations" and watching him do a talk makes you think "If I could get to his level, I could build my own light sabre.... in Perl!" :) But O'Reilly book sales figures tell the tale.... Perl book sales - drastically down. Python and Ruby book sales - dramatically up. Perl 6 is partly to blame for that, imho. It was announced with much fanfare, never arrived, and people got tired of waiting for the Perl Gods to deliver a better a perl because someone did it faster by delivering Python and Ruby. <br>
<br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word;"><div></div><div>It really boils down to the standards and practices you or your company implements. If you're using Perl for system administration tasks only, well I think all bets are off unless you police yourself. If you're using it for an actual application using a framework like Catalyst though, I know from experience its easy to make the code clean and readable.</div>
</div></blockquote><div><br>I think it takes far more effort and expertise to write "good, maintainable Perl code" and given the other improvements in the design of Ruby and Perl - why bother? <br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div style="word-wrap: break-word;"><div></div><div>Back to Ron's question. My favorite element of Perl is CPAN and the maturity of the packages these days. You can find some excellent modules out there, such as the Moose Post-Modern Object System, Catalyst, and pretty much anything else you'll ever need.</div>
</div></blockquote><div><br>CPAN is pretty awesome. I'd also point any budding programmer to the Data::Dumper module, which will help you visualize your arrays of hashes of hashes and figure out where you're messing them up. Because you will mess them up. Btw, you better like #'s, $'s, and {}'s, and @'s because you're going to overdose on them. And that... is the brain-rot factor for me. :) <br>
<br>I don't know what ORDM's look like in Perl these days? Are they as nice as ActiveRecord or Python's equivalent? <br> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div></div></blockquote><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word;"><div><br></div><div>Also, get a copy of Perl Best Practices now and read through it. It'll help you out a lot in the long run.</div>
</div></blockquote><div><br>I've also heard Damien Conway's "Object Oriented Perl" book is exceptionally well written and a worth-while read for both perl and non-perl programmers. <br><br>-Rob <br><br></div>
</div>