为什么Perl有这么多的“魔术”?

前端之家收集整理的这篇文章主要介绍了为什么Perl有这么多的“魔术”?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
通过 perlsubperlop联机帮助页,我注意到有很多“魔术”和“魔术”的引用(只需搜索“魔术”).我不知道为什么Perl如此丰富.

一些例子:

print ++($foo = 'zz')            # prints 'aaa'       
printf "%d: %s",$! = 1,$!      # prints '1: Operation not permitted'
while (my $line = <FH>) { ... }  # $line is tested for definedness,not truth
use warnings; print "0 but true" + 1  # "0 but true" is a valid number!

解决方法

当Perl功能被描述为“魔术”时:

It means that that feature is
implemented by NBA star Magic Johnson.
Whenever Perl executes “magic”,it is
actually sending an RPC call to a
remote receiver implanted in Magic
himself. He computes the answer,and
then sends a return message. The use
of Mr. Johnson for all the hard parts
of Perl provides a great abstraction
layer and simplifies porting to new
platforms. It’s way easier than,say,
the Apache Portable Runtime.

资料来源:perrin on Perl Monks

这是官方的! Perl更神奇

从以下Google搜索点击:

25  site:ruby-doc.org     magic
 36  site:docs.python.org  magic
497  site:perldoc.perl.org magic
原文链接:https://www.f2er.com/Perl/172754.html

猜你在找的Perl相关文章