标签

2016年4月5日星期二

Perl: The first and last lines

1. Get the first and last lines

#!/usr/bin/perl -w
use strict;

print scalar <DATA>; # the first line
while (<DATA>) {
    print if eof; # the last line after loop
}


__DATA__
first
second
third
lastline

Output:

first
lastline

2. Get the first and last lines

#!/usr/bin/perl -w
use strict;

my $last;
my $first = <DATA>; # the first line

while (<DATA>) {
    $last = $_;  # the last line after loop
}
close DATA;

print "$first";
print "$last";


__DATA__
first
second
third
lastline

3. Skip the first line

readline <DATA>;
scalar <DATA>;
my $first = <DATA>;
@all = split /\s+/, <DATA>;

 

 

 

 

 

 

2016年4月2日星期六

Adobe Acrobat

配置:

编辑——首选项——辅助工具——忽略页面显示——总是使用页面布局样式——单页连续

                                                                                   总是使用缩放设置——适合宽度