📜  Perl 与Java

📅  最后修改于: 2021-09-11 03:53:59             🧑  作者: Mango

Perl 是由 Larry Wall 于 1987 年开发的。 Perl 支持面向对象和过程编程。它很像 C 和 C++。 Perl 最初是为文本处理而开发的。

Java是一种广泛使用的编程语言。 Java不仅是一种编程语言,也是一种计算平台。 Java于 1995 年由 Sun Microsystems 发布,由 James Gosling 发起。据 Oracle 称, Java在全球 30 亿台设备上运行。它旨在让开发人员一次编写,随处运行,这意味着Java程序可以在一个平台上编译并在任何其他具有 JVM 的平台上执行。

下面是 Perl 和Java之间的一些主要区别

Feature Perl Java
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. Java is a programming language and a computing platform. Still there are softwares and websites that won’t work unless you have java installed. It is fast, secure and reliable.”
Compiled Format Perl 6 is specifically compiled to Parrot Bytecode, while Perl 5 and older versions are interpreted language. It is stored with extension .pbc. Java programs are compiled to bytecode.
Java bytecode can be shared through the network and then can be executed on any machine having JVM. It is stored with extension .class.
Associative Arrays Associative Arrays are defined very concisely for Perl. Java does not have a concise way of creating associative arrays. However it hash implementations.
Focus Common tasks such as file scanning and report generation are accentuately supported by Perl. Java mostly focuses on application development, software tools, server app, and big data technologies.
File Extension Perl programs are saved with .pl extension.
Eg: MyFile.pl
Java programs are saved with .java extension.
Eg: MyFile.java
Typed Method Perl is dynamically typed i.e. most of the type checking is performed during run time. Java is statically typed i.e. most of its type checking is performed during compile time.
Comments and Documentation Inline comments in Perl are written using #
E.g. #Inline-Comment in Perl

Documentation in Perl is done using = and =cut.
Eg: =Perl Documentation follows the following syntax =cut

Single line comments in Java are declared using //
Eg: //Single line Comment .

Multiline comments are written using /*……*/
Eg: /* it’s a multiline comment */

Documentation in Java is done using.
/**…………*/

Eg:
/**Documentation in Java*/

End of Statement In Perl every statement must end with a semi-colon(;) In Java every statement must end with a semi-colon(;)