Perl vs Python

Feature Perl Python Introduction Perl 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. Whitespaces Perl does not care about whitespaces. Python deals with whitespaces and a syntax error generates if whitespaces are not according to Python. Focus Perl 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 Extension The .pl file extension is used to save Perl Scripts. For example The .py file extension is used to save Python Scripts. Example: End of Statement All 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 Documentation For Inline comments, we use # in Perl.
eg # Inline-Comment in Perl
whereas for documentation we use
= and = cut
eg = Documentation in Perl
starts from here and ends here. = cut Python also uses # for Inline comments.
eg # Inline-Comment in Python
but for documentation we use
“” ”ie Three inverted commas
eg “” ”Documentation in Python
starts from here and ends here.” ”” Statement Blocks Perl uses braces to mark the statement blocks. Python use indentations to mark the statement blocks. Datatypes Some data types contained by Perl are numeric, string, Scalars, Arrays, Hashes. Some data types contained by Python are numeric, strings, lists, dictionaries, tuples.

Get Solution for free from DataCamp guru