2.9 相关资源

要确定你的系统中是否已经有Perl,可在shell提示符中输入以下命令。请先打开命令行或shell窗口,例如Mac中的Terminal窗口(在Application/Utilities路径下),或者是Windows的命令行窗口(打开开始菜单,在菜单栏底部的文本框中键入cmd)。在命令提示符中键入:

  1. perl v

如果Perl已经安装好且能够运行,则这个命令会返回Perl的版本信息。笔者的Mac上运行的是Lion操作系统,已用编译源代码的方式(参见http://www.cpan.org/src/5.0/perl-5.16.0.tar.gz)安装了最新版本的Perl(5.16.0是编写本书时最新的版本)。键入以上命令时,笔者得到了以下信息:

  1. This is perl 5, version 16, subversion 0 (v5.16.0) built for darwin-2level
  2. Copyright 1987-2012, Larry Wall
  3. Perl may be copied only under the terms of either the Artistic License or the
  4. GNU General Public License, which may be found in the Perl 5 source kit.
  5. Complete documentation for Perl, including FAQ lists, should be found on
  6. this system using "man perl" or "perldoc perl". If you have access to the
  7. Internet, point your browser at http://www.perl.org/, the Perl Home Page.

在编译源代码和生成程序时,perl和perldoc都安装在/usr/local/bin中,你需要将其加入你的系统路径中。关于设置路径变量的信息,请参见http://java.com/en/download/help/path.xml