哪里有一些学习 Perl 5.10 新功能的好资源?

发布于 2024-07-07 05:46:53 字数 156 浏览 8 评论 0原文

直到最近我才意识到 Perl 5.10 有重要的新功能,我想知道是否有人可以给我一些好的资源来学习这些功能。 我在谷歌上搜索了它们,我发现的只是一些幻灯片和快速概述。 有些功能(至少对我来说)如果有更多解释就更好了。

任何链接将不胜感激。

-fREW

I didn't realize until recently that Perl 5.10 had significant new features and I was wondering if anyone could give me some good resources for learning about those. I searched for them on Google and all I found was some slides and a quick overview. Some of the features (to me at least) would be nice if they had more explanation.

Any links would be appreciated.

-fREW

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

简美 2024-07-14 05:46:53

perldelta 联机帮助页包含所有详细信息。 有一个简短(但信息丰富)的幻灯片演示, Perl 5.10 适合那些还没有完全疯狂的人。 关于这个问题还有一个很好的 PerlMonks 讨论

The perldelta manpage has all the nitty-gritty details. There's a brief (but informative) slide presentation, Perl 5.10 for people who aren't totally insane. And a good PerlMonks discussion on the issue.

演多会厌 2024-07-14 05:46:53

我发现这篇文章很有用。

这个一个更侧重于5.10高级正则表达式。

还有初学者Perl 5.10 简介

最后,这是关于为什么应该开始使用 Perl 5.10 的优秀摘要,我从中提取了以下内容:

  • 状态变量 不再有带有外部卷曲块的作用域变量,或者顽皮的 my $f if 0 技巧(后者现在是语法错误)。
  • 已定义 - 或不再 $x = 已定义 $y ? $y : $z,你可以写 $x = $y // $z 来代替。
  • regexp 改进 dave_the_m 完成了很多清理内部工作的工作,这为 demerphq 添加各种新的很酷的东西铺平了道路。
  • 更小的可变足迹 Nicholas Clark 致力于 SV、AV、HV 和其他数据结构的实现,以将其大小减小到恰好在 32 位架构上达到最佳点的程度
  • 更小的恒定子足迹 Nicholas Clark 减少了恒定子的大小(就像使用常量 FOO => 2)。 当加载像 POSIX 这样的模块时,结果是很重要的。
  • 堆叠文件测试你现在可以说 if (-e -f -x $file)。 Perl 6 本来应该允许这样做,但他们朝不同的方向发展。 那好吧。
  • 词法 $_ 允许您嵌套 $_ (不使用 local)。
  • _ 原型 你现在可以用原型 声明一个子组件。 如果不带参数调用,则使用 $ 来填充(允许您更干净地替换内置函数)。
  • x 运算符现在可以说我的 @arr = qw(xyz) x 4。(更新:此功能在 blead 中实现后向后移植到 5.8 代码库,这就是 Somni 注意到它在 5.8 中可用的方式。 8).
  • switch 一个真正的 switch/given 结构,受到 Perl 6
  • 智能匹配运算符 (~~) 的启发,配合 switch
  • 闭包改进 dave_the_m 彻底修改了闭包处理代码,以修复许多错误行为和内存泄漏。
  • 更快的 Unicode lc、uc 和 /i 在 Unicode 字符串上更快。 UTF-8 缓存的改进。
  • 改进的排序在可能的情况下执行就地排序,而不是使用临时排序。 排序函数可以递归调用:您可以
  • 在 void 上下文中对树图进行排序不再是邪恶的。 仅在道德上。
  • 创建匿名列表和哈希时使用的操作码更少。 更快的猫咪!
  • 污染改进 更多可能被污染的东西被标记为这样(例如 sprintf 格式)
  • $# 和 $* 被删除 远距离动作减少
  • perlcc 和 JPL 被删除 这些东西只是 bug 磁铁,没有人足够关心它们。

I found this article useful.

This one is more focused on 5.10 Advanced Regular Expressions.

And also A beginners' Introduction to Perl 5.10.

Finally, this excellent summary on why you should start using Perl 5.10 and from which I extracted the following:

  • state variables No more scoping variables with an outer curly block, or the naughty my $f if 0 trick (the latter is now a syntax error).
  • defined-or No more $x = defined $y ? $y : $z, you may write $x = $y // $z instead.
  • regexp improvements Lots of work done by dave_the_m to clean up the internals, which paved the way for demerphq to add all sorts of new cool stuff.
  • smaller variable footprints Nicholas Clark worked on the implementations of SVs, AVs, HVs and other data structures to reduce their size to a point that happens to hit a sweet spot on 32-bit architectures
  • smaller constant sub footprints Nicholas Clark reduced the size of constant subs (like use constant FOO => 2). The result when loading a module like POSIX is significant.
  • stacked filetests you can now say if (-e -f -x $file). Perl 6 was supposed to allow this, but they moved in a different direction. Oh well.
  • lexical $_ allows you to nest $_ (without using local).
  • _ prototype you can now declare a sub with prototype . If called with no arguments, gets fed with $ (allows you to replace builtins more cleanly).
  • x operator on a list you can now say my @arr = qw(x y z) x 4. (Update: this feature was backported to the 5.8 codebase after having been implemented in blead, which is how Somni notices that it is available in 5.8.8).
  • switch a true switch/given construct, inspired by Perl 6
  • smart match operator (~~) to go with the switch
  • closure improvements dave_the_m thoroughly revamped the closure handling code to fix a number of buggy behaviours and memory leaks.
  • faster Unicode lc, uc and /i are faster on Unicode strings. Improvements to the UTF-8 cache.
  • improved sorts inplace sorts performed when possible, rather than using a temporary. Sort functions can be called recursively: you can sort a tree
  • map in void context is no longer evil. Only morally.
  • less opcodes used in the creation of anonymous lists and hashes. Faster pussycat!
  • tainting improvements More things that could be tainted are marked as such (such as sprintf formats)
  • $# and $* removed Less action at a distance
  • perlcc and JPL removed These things were just bug magnets, and no-one cared enough about them.
萌能量女王 2024-07-14 05:46:53

Perl Tips 中有一系列关于 Perl 5.10 的文章:

还有我的 Perl 5.10 中的新增功能 幻灯片,位于 Perl Training Australia 的演示页面,但由于它们是在 5.10 发布之前编写的,因此某些内容可能略有更改。 我相信 rjbs 的 Perl 5.10 适合人们谁不是完全疯了现在涵盖了我的幻灯片曾经使用过的所有内容。

祝一切顺利,

Paul

强制偏见披露:我写了这篇文章中提到的几乎所有资源,

There's been a string of articles in Perl Tips about Perl 5.10:

There are also my What's new in Perl 5.10 slides on Perl Training Australia's presentations page, but since they were written before 5.10 was released, some things may have changed slightly. I believe that rjbs' Perl 5.10 for people who aren't totally insane now covers everything my slides used to.

All the best,

Paul

Mandatory bias disclosure: I wrote almost all of the resources mentioned in this post,

深府石板幽径 2024-07-14 05:46:53

学习 Perl,第五版及更高版本 5.10。 除此之外,其他人提到的资源,包括perldelta,都相当不错。 我写了几篇关于 The effective Perler。

最好的开始方法是选择一个有趣的功能并尝试一下。 您将找到的指南的作者就是这样解决的。 这就是你真正应该开始学习任何语言的方式。

Learning Perl, Fifth Edition and later scover 5.10. Other than that, the resources that other people mentioned, including perldelta, are pretty good. I've written a couple of articles about some of the features for The Effective Perler.

The best way to get started is to pick an interesting feature and play around with it. That's how the authors of the guides you'll find figured it out. That's how you really should start learning anything is just about any language.

享受孤独 2024-07-14 05:46:53

正则表达式改进包括命名捕获:看这里

Regex Improvements include named captures: Look Here

日记撕了你也走了 2024-07-14 05:46:53

请参阅 Ricardo Signes 的幻灯片,了解他出色的“Perl 5.10 For People Who Aren’t Totally Insane”。

http://www.slideshare.net/ rjbs/perl-510-for-people-who-rent-totally-insane

See Ricardo Signes' slides for his excellent "Perl 5.10 For People Who Aren't Totally Insane."

http://www.slideshare.net/rjbs/perl-510-for-people-who-arent-totally-insane

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文