Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1148017
  • 博文数量: 312
  • 博客积分: 12522
  • 博客等级: 上将
  • 技术积分: 3376
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-27 18:35
文章分类

全部博文(312)

文章存档

2016年(3)

2015年(1)

2013年(1)

2012年(28)

2011年(101)

2010年(72)

2009年(13)

2008年(93)

分类: IT业界

2011-07-13 20:54:51

#!/usr/bin/perl
# Program, named literals.perl, written to test special literals
print "We are on line number ", __LINE__, ".\n";
print "The name of this file is ",__FILE__,".\n";
__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

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