加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

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

发布时间:2020-12-15 21:14:15 所属栏目:大数据 来源:网络整理
导读:通过 perlsub和 perlop联机帮助页,我注意到有很多“魔术”和“魔术”的引用(只需搜索“魔术”).我不知道为什么Perl如此丰富. 一些例子: print ++($foo = 'zz') # prints 'aaa' printf "%d: %s",$! = 1,$! # prints '1: Operation not permitted'while (my $
通过 perlsub和 perlop联机帮助页,我注意到有很多“魔术”和“魔术”的引用(只需搜索“魔术”).我不知道为什么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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读