
If I think I'm ever going to edit the script again, I consider Python instead. Whereas Python is easy to understand, and it needs functions for text processing. Though Perl is not easy to learn, it makes text processing short & straightforward. Perl needs a semicolon to determine the end of the line, but Python does not require it. I still use Perl quite a lot, but it's now more for one-liners and "throwaway" scripts which will only run once. There are a few significant differences between Perl vs Python. Easy enough that you might actually use it. Writing docstrings in Python is much easier than writing pod markup in Perl.
#Python vs perl code
You'll wonder at which point you must have blacked out.ĭocumenting is important if your code is going to be around a while. Perl requires a semicolon to indicate the end of the line, but python doesnt need it. Worse even is when you encounter your own Perl after many years. There are a few of the major differences between Perl vs Python. On the other hand, Python is more robust, scalable, and durable. Python suffers from this unreadability problem far less due to its design. Perl is a high-level language that is simpler to learn when compared with the Python language. If you've ever read someone else's Perl, you may know that it can be about the most frustrating thing to unravel. Python's principles ( import this) are much better suited to collaborating with others when compared to Perl's TMTOWTDI principle. Believe me, in the long run you want lots of reusable code (and not cut-and-paste!) Writing OO (or even reusable) code in Perl is not easy compared to Python. Before too long, you have a sprawling file of line noise which is a PITA to maintain. All too often a "quick n' dirty" script has more features crept in over time, yet still implemented in a hasty manner. Perl and Ruby are pure script languages and the main goal of them is to make codes shorter while you can write large programs using them. It takes a lot of discipline to write good Perl. Lately I have been making an effort to use more Python for the following reasons: This is quite important when you have to get something working on-the-spot. Really, Python is a better choice even for C/C++ programmers who also. For almost any task, Python is a better choice for many reasons, especially for C/C++ programmers who are unfamiliar with both Perl and Python.


Its regex syntax is really simple, and it lends itself quite well to extremely fast script development. Python is Cool (and Perl is not), Especially for C/C++ Programmers.
#Python vs perl how to
You are going to encounter both as a sysadmin, so you'll want to know how to read/troubleshoot/debug both.Īs for writing scripts, I have used mostly Perl over the last 10 years for most of my sysadmin utility and "glue" scripts.
