13.07.2015 Views

Perl 语言编程 - Linux教程

Perl 语言编程 - Linux教程

Perl 语言编程 - Linux教程

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

名 的 非 常 技 巧 性 的 方 法 。 你 可 以 把 一 个 coderef 绑 定 到 一 个 现 存 的 名 字 上 , 方 法 是 把 它 赋予 一 个 类 型 团 , 该 类 型 团 的 名 字 就 是 你 想 要 的 函 数 。( 参 阅 第 十 章 , 包 , 里 的 “ 符 号 表 ” 一 节 。在 本 例 中 , 我 们 将 把 它 绑 定 到 两 个 不 同 的 名 字 上 , 一 个 是 大 写 , 一 个 是 小 写 。@colors = qw(red blue green yellow orange purple wiolet);for my $name (@colors) {no strict 'refs';# 允 许 符 号 引 用*$name = *(uc $name) = sub { "

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!