Chinaunix首页 | 论坛 | 博客
  • 博客访问: 49813
  • 博文数量: 19
  • 博客积分: 1504
  • 博客等级: 上尉
  • 技术积分: 190
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-06 14:21
个人简介

系统运维

文章分类
文章存档

2013年(6)

2011年(2)

2009年(4)

2008年(7)

我的朋友

分类:

2008-11-12 14:45:38

(The Script)
    #!/usr/bin/perl
    # Program, named literals.perl, written to test special literals
1   print "We are on line number ", _ _LINE_ _, ".\n";
2   print "The name of this file is ",_ _FILE_ _,".\n";
3   _ _END_ _
    And this stuff is just a bunch of chitter–chatter that is to be
    ignored by Perl.
    The _ _END_ _ literal is like Ctrl–d or \004.

(Output)
1   We are on line number 3.
2   The name of this file is literals.perl.

Explanation

  1. The special literal _ _LINE_ _ cannot be enclosed in quotes if it is to be interpreted. It holds the current line number of the Perl script.

  2. The name of this script is literals.perl. The special literal _ _FILE_ _ holds the name of the current Perl script.

  3. The special literal _ _END_ _ represents the logical end of the script. It tells Perl to ignore any characters that follow it.

阅读(1417) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~