Perl语言编程学习(1)

# 第二章 here document
# 打印下行 10 次
# 后面必须有个空行
print << "" x 10;
Hello world!
#!/usr/bin/perl
use warnings;
use strict;
# 范围操做符

my $file = $ARGV[0];  # 命令行上挂个文件名
open IN, '<', $file or die "Fail to open '$file': $!";
while (<IN>) {
 if (10 .. 20) { print; }
}
相关文章
相关标签/搜索