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; }
}
相關文章
相關標籤/搜索