Skip to content
Related Articles

Related Articles

Improve Article
Perl vs Python
  • Difficulty Level : Basic
  • Last Updated : 23 Jan, 2019

Perl is a general purpose, high level interpreted and dynamic programming language. It was developed by Larry Wall, in 1987. Perl was originally developed for the text processing like extracting the required information from a specified text file and for converting the text file into a different form. Perl supports both the procedural and Object-Oriented programming. Perl is a lot similar to C syntactically and is easy for the users who have knowledge of C, C++.

Python is a widely used general-purpose, high level programming language. It was initially designed by Guido van Rossum in 1991 and developed by Python Software Foundation. It was mainly developed for emphasis on code readability, and its syntax allows programmers to express concepts in fewer lines of code.

Below are some major differences between Perl and Python:

FeaturePerlPython
IntroductionPerl is a general purpose high level language popular for CGI scripts. Some of the popular projects in Perl are CPanel and Bugzilla. It was initially designed to replace complex shell scripts.Python is a widely used general-purpose, high level programming language. Due to its rich library and support, it has wide applications in Web Development, Machine Learning, Desktop Applications, etc.
WhitespacesPerl does not care about whitespaces.Python deals with whitespaces and a syntax error generates if whitespaces are not according to Python.
FocusPerl accentuates support for common tasks such as report generation and file scanning.Python accentuates support for common methodologies such as object-oriented programming and data structure design.
File ExtensionThe .pl file extension is used to save Perl Scripts. For example myDocument.plThe .py file extension is used to save Python Scripts. Example: myFile.py
End of StatementAll statements should end with a semi colon in Perl.It is not necessary to end the statements with a semi colon in Python as it deals with whitespaces.
Comments and DocumentationFor Inline comments, we use # in Perl.
e.g. #Inline-Comment in Perl
whereas for documentation we use
= and =cut
e.g. =Documentation in Perl
starts from here and ends here. =cut
Python also uses # for Inline comments.
e.g. #Inline-Comment in Python
but for documentation we use
“”” i.e. Three inverted commas
e.g. “””Documentation in Python
starts from here and ends here.”””
Statement BlocksPerl uses braces to mark the statement blocks.Python use indentations to mark the statement blocks.
DatatypesSome data types contained by Perl are numeric, string, Scalars, Arrays, Hashes.Some data types contained by Python are numeric, strings, lists, dictionaries, tuples.

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up
Recommended Articles
Page :