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.

sub AUTOLOAD {my $program = our $AUTOLOAD;$program =~ s/.*:://;# 截 去 包 名 字system($program, @_);}( 恭 喜 , 你 刚 刚 实 现 了 和 <strong>Perl</strong> 一 起 发 布 的 Shell 模 块 的 一 种 冗 余 的 形 式 。) 你 可 以 象 下面 这 样 调 用 你 的 自 动 装 载 器 ( 在 Unix 里 ):date();who('am', 'i');is('-l');echo("Abadugabuadaredd...");实 际 上 , 如 果 你 预 先 按 照 这 种 方 法 声 明 你 想 要 调 用 的 函 数 , 那 么 你 就 可 以 认 为 它 们 是 内 建 的函 数 并 且 在 调 用 的 时 候 忽 略 圆 括 弧 :sub date (;$$); # 允 许 零 到 两 个 参 数 。sub who (;$$$$);sub ls;sub echo ($@);# 允 许 零 到 四 个 参 数# 允 许 任 意 数 量 的 参 数# 允 许 至 少 一 个 参 数date;who "am", "i";ls "-l";echo "That's all, folks!";275

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

Saved successfully!

Ooh no, something went wrong!