跳转至

【Perl 和 Ruby 的区别

原文:https://www . geeksforgeeks . org/perl 和 ruby 的区别/

【Perl】是一种通用的、高级解释的动态编程语言。它是拉里·沃尔在 1987 年开发的。Perl 最初是为文本处理而开发的,比如从指定的文本文件中提取所需的信息,以及将文本文件转换成不同的形式。Perl 支持过程式和面向对象编程。Perl 在语法上与 C 非常相似,对于有 C、C++知识的用户来说很容易。

Perl

# Simple Perl program
#!/usr/bin/perl

# Below line will print
# "Welcome to GeeksforGeeks!"
print "Welcome to GeeksforGeeks!\n";

输出:

Welcome to GeeksforGeeks!

Ruby 是由松本幸弘(在 Ruby 社区中也被称为 Matz)于 20 世纪 90 年代中期在日本开发的纯面向对象语言。Ruby 中的所有东西都是一个对象,除了块,但是也有它的替代物,即 procs 和 lambda。Ruby 开发的目标是让它成为人类程序员和底层计算机器之间的合理缓冲。Ruby 的语法类似于 C 和 Java 等许多编程语言,因此 Java 和 C 程序员很容易学习。它几乎支持所有平台,如视窗、苹果、Linux。

红宝石

# Simple Ruby program
puts "Welcome to GeeksforGeeks!"

输出:

Welcome to GeeksforGeeks!

【Perl 和 Ruby 的区别:

| Perl | Ruby | | --- | --- | | Perl 是一种高级、通用、可解释、动态的编程语言。 | Ruby is a dynamic, object-oriented and reflective universal programming language. | | It is a less object-oriented language. | It is a pure and highly object-oriented language. | | There are fewer libraries in Perl than in Ruby. | Compared with Perl, there are more libraries in Ruby. | | Its support for Unicode is much stronger than Ruby's. | Its support for Unicode is not as strong as Perl. | | The file extension for Perl is . pl" **。** | Ruby uses the file extension **. rb”。** | | 说到支持正则表达式的它有非常多的库。 | Compared with Perl, it has less support for regular expressions. | | Perl 语言的框架是催化剂. | 红宝石的框架是 Rails 上的 Ruby . | | Support multiple variable types. | It has only one variable type. | | Perl is very fast in execution. | Ruby's script execution speed is decent enough. | | Perl 最常用于 CGI(Common Gateway Interface)脚本中,与 C 一起用于 web 服务器,因此在服务器技术领域被广泛使用。 | Ruby is very strong in meta-programming, which allows the creation of a mythical product, such as a vagrant. |

我们一直在努力

apachecn/AiLearning

【布客】中文翻译组