3 ms·
I moved from Perl to Python 3 years ago. Its true. Perl feels like a very powerful base language, moving to Python felt like you were taking a bit away (I know
by collyw 13y ago
I moved from Perl to Python 3 years ago.
Its true. Perl feels like a very powerful base language, moving to Python felt like you were taking a bit away (I know in reality you can probably achieve much the same things). Python on the other hand doesn't require you to implement your own basic functions (max, min , trim / strip ) as they are included already. Python stops me from shooting myself in the foot as often, by not allowing me to do stuff that is too clever too early.
I do miss being able to reference / deference variables explicitly though. Other great things are, CPAN, regular expression support (that never feels as nice in Python), one liners for doing stuff quickly on the command line. I even quite like the sigils, as an easy way to recognize the types of variable you are dealing with (though it is confusing at first). Working with strings feels a lot more natural in Perl than Python.
- mxey 13y agomax and min are part of List::Util, a library that comes with Perl
- eCa 13y agoLink for the lazy: https://metacpan.org/pod/List::Util https://metacpan.org/pod/List::Util Or even better, just use List::AllUtils - https://metacpan.org/pod/List::AllUtils https://metacpan.org/pod/List::AllUtils
- berntb 13y ago>> max, min [etc] Perl has a minimal std library, to teach people to use CPAN I guess. But even Perl has util modules for trivial help functions in the std install (at least those which aren't one line of code to define). The strongest argument for Perl today is CPAN and CPAN Testers, still the gold standard. But all the scripting languages are really similar, there is no reason to learn another if you already know one. Edit: You might want to check out the Modern Perl book, free online. Perl evolves quite fast.
- collyw 13y agoDjango was the reason I switched. I gave Catalyst a go, but the ability to swap out almost every component left me wondering what the framework actually was. The documentation was significantly easier (for a newbie to web frameworks) to get something going. And the Django admin gave me a large chunk of what I wanted for very little effort.
- berntb 13y agoYeah, Django has a really well planned ramp up for a newbie. Especially compared to Catalyst among the Perl frameworks. The ORM was a bit of pain (had to do jump through hoops just to get multiple column indexes, iirc?). But in the end, after a few months of work it doesn't make so much difference in total time.
- vorg 13y ago> I moved from Perl to Python 3 years ago But Perl-like ambiguity still seeps into your English. Was that Python 3, or 3 years ago?
- collyw 13y agoIt's all implicit. Python 3 wasn't available "years ago", so I must have been moving to Python 2, 3 years ago. (Ok, I just checked, Python 3 has been around longer than I thought).
- danielweber 13y agoI used to use Perl. Then I followed Yegge's advice of "I will only use Perl if there's no other option, and there's always another option." https://sites.google.com/site/steveyegge2/ancient-languages-perl https://sites.google.com/site/steveyegge2/ancient-languages-... I'm not trying to dump on perl. I love C and C++ and those get dumped on all the time and I hate it. But anything I could do in Perl I instead do in Ruby. It's not as fast, but if fast matters I'm not supposed to use a scripting language.
- DougWebb 13y agoBut anything I could do in Perl I instead do in Ruby. It's not as fast, but if fast matters I'm not supposed to use a scripting language. Perl can actually be very fast; it depends on what you're doing and how you write it. A lot of developers don't realize that Perl isn't really a scripting language; it's a compiled language that has a compiler that's so fast it can be run every time you run the program. The compiler produces bytecode, and the bytecode runs on a virtual machine, just like Java and C#. The key to writing fast Perl code is to use programming constructs that compile down to single bytecode operations, because those operations are implemented in the VM using well-tuned C code. For example, using grep and map with array variables is much faster than using a for loop and explicitly indexing through the array. With the former, the enumeration is handled in C code, while in the latter it's handled in Perl code. Note: that's probably not 100% accurate, but it's the general idea. You can actually have perl output the bytecode it generates so you can take a look at it, and figure out places where changing how your code is structured will produce more efficient bytecode.