4 ms·
Would it be beneficial to know this alongside of Python, or is it more used instead of Python?
by doctoboggan 15y ago
Would it be beneficial to know this alongside of Python, or is it more used instead of Python?
- buckwild 15y agoI personally found that I didn't need Perl at all. I am a bioinformatics programmer/scientist and Perl was the first language I learned. I find that whatever I can do in Perl I can do with bash/awk/sed--and whatever I can't do with bash/awk/sed I can do in Python. I've never been happier.
- lambda_cube 15y agoWhatever you can do in one Turing complete language you can also do in all other Turing complete languages. The point isn't what you can do, the point is what tasks are easier, simpler or faster to do in one language compared to another language, while also respecting how hard the language is to learn to get to the point where can can do what you want (easily). I would prefer to use Perl over bash/awk/sed since Perl is good at the same things and more and has alot more libraries.
- neuroelectronic 15y agoobviously in such a small (in terms of computing in general) discipline, a general purpose language might not be the best. Now if you want to publish your results to AWS and a website and pull data from a website front-end, etc. You can probably do it quickest with ducttape.
- jrockway 15y agoPerl's advantage over bash/awk/sed is that you can test, organize, and maintain code more effectively. This may not matter if you are programming to solve tiny unrelated problems, but it's a waste of effort if you are doing similar things frequently. Python is basically Perl but with different syntax, libraries, and community.
- Cushman 15y agoOut of curiosity, what do you consider to distinguish one Turing-complete language from another aside from those three traits?
- jrockway 15y agoSemantics. For example, writing a program to read "2 + 2" and evaluate the result is going to be very different from Perl and Python in Java or C++.
- jeberle 15y agoI agree w/ you about 90% on this. However, you're painting w/ a broad brush including Awk and Sed. I imagine beyond 10 lines of Awk (gsub, anyone?) or about 1 line of Sed things get tenuous, and you would want to reach for Perl or Python. Sed & Awk are great for tiny stuff, but wear thin fast. The realm of text-only problems, about 15 to 40 lines of code is where I find Perl shines. Python is probably my favorite language, but it can be horribly clunky for these sorts of tasks.
- chromatic 15y agoPerl's used more widely than Python, if you look at job trends -- but then again, you have to consider that Perl 5 was more popular earlier, so there's a lot of entrenched usage. Python may or may not have more new projects written in it; the statistics are difficult to interpret. You can get by knowing one or the other well. Perl's advantages to me are the CPAN, the tooling culture, the testing culture, and a very pragmatic approach to getting things done without the language or ecosystem dictating how. Python's advantages are slightly cleaner defaults in Python 3 and the fact that all code looks basically the same. (I'm not sure I see that as an advantage, but other people do.)
- berntb 15y agoThe scripting languages are quite similar. IMHO, it is better to learn something different instead of another one of them. Perl has an emphasis on libraries. CPAN is the gold standard for the scripting languages. (To see what I mean -- search for signatures, Moose and Acme::Bleach on search.cpan.org. (+) ) Another good thing is the community of smart and laid back people. I personally prefer to do Perl because it is fun. The main disadvantage with the Perl "everything and the kitchen sink" attitude is if you are in a group without good coding standards... Perl also gets a tougher learning curve in the beginning, just from there being more to learn. (+) Joke modules on CPAN generally start with Acme. Edit: Huh, why down votes? Just a reflex by language trollers? :-)
- lambda_cube 15y agoThat depends on what you want to do. If you want to do things with text, especially transforming text, Perl is IMO opinion better at that task. Perl has been the scripting language for me, but I'm thinking of changing to Python because of NumPy, SciPy and the libraries for numerical analysis and scientific computing. Python seems to be better than Perl in that area. This is a library issue whereas when it comes to text processing it's more of a language thing. I think Perl and Python have a lot more in common than differences when it comes to what they are good at. If you know one scripting language, you don't gain as much when you learn the next. My recommendation is to learn something different, C, Haskell, Lisp or Prolog for example. That would make you think in different ways. Also, chromatic (a Perl developer) gives a very balanced answer in a sibling to my answer, so I won't repeat what he said.
- frossie 15y agoIf you want to stick to perl, you might want to check out http://pdl.perl.org/ http://pdl.perl.org/ if you haven't already. You can do a fair amount of scientific computing with it. Among other things it overloads the basic operators, so $a+$b will do the right thing, even if $a and %b are matrices/images, so it is very easy to "read" if you are a perl person already.
- deleted 15y ago[deleted]
- kamaal 15y agoPython is a beautiful language too! Perl has its own strengths. In order to win as scripting language on the UNIX environment a language will have to get some things right very well. Two of them namely 'Processes' and 'Files(text)'. UNIX is really about these two things heavily. That is why you will see UNIX by a vanilla installation has shipped with tools like sed, grep, awk, cut, tr, cat and other text processing tools for decades. Because a file can act as a pretty good representation for data, storage and problem representation use cases. Another area that the language will have to get right is 'DBMs'. Speaking of Perl's merits as scripting languages alone, Perl offers a native way of interacting with all these things that I mentioned in the previous paragraph. Things like ``, system(), open(), close() , die(), chomp, while<FILEHANDLE>), split(), grep, !~ , ~= and regular expressions make text processing a breeze. In addition, Higher order parsing is very easy in Perl too, Regular expressions are first class objects. For more information on this you can read Mark Jason Dominus's Higher order Perl. Which is a free book. Now coming to Perl's merits as general purpose scripting language. You have your usual language tool kit with data structures(usual numbers, strings), arrays, hashes. Flow control, functions, OO, functional programming features. But the plus and the biggest winner is the extension system. There is a huge repository of readily solved problems on the CPAN. You have language extension modules like Moose, Try::Tiny, etc etc. In terms of the web development ecosystem, Perl has catalyst, DBIx::Class, Plack etc etc. You also have a good asynchronous programming framework. In terms of documentation. Check out the amazing perldoc.perl.org. There is also Learning Perl, Programming Perl and recently Chromatic's beautiful book 'Modern Perl book'. In terms of development practice and stability. Perl has a track record and battle tested for decades now, Its used to develop mission critical applications. For best practices you can read Damian Conway's Best practices book. Also, Checkout enlightened Perl and Task::Kensho for the best of the breed modules. As a plus and cherry on the cake, there is a new sister programming language called Perl 6 in the making. With great concepts, cleaner defaults and more pragmatic in the real world. Perl 6 is usable today with Rakudo. Give it a whirl.