- 论坛徽章:
- 5
|
本帖最后由 pitonas 于 2014-07-28 06:57 编辑
这个有很多种写法。~ {:2_179:}
PART 1: 高端大气上档次- sub show {
- print join( ', ', map '[' . join( ', ', @$_ ) . ']', @_ ) . $/;
- }
- my @a = 1 .. 8;
- my @A = map [ @a[ $_, $_ + 1 ] ], grep !( $_ % 2 ), 0 .. $#a;
- show @A;
- my @B = map [ @a[ $_, $_ + 1 ] ], grep --$|, 0 .. $#a;
- show @B;
- my @C = map [ @a[ $_, $_ + 1 ] ], map $_ * 2, 0 .. $#a / 2;
- show @C;
- my @D = map { --$| ? [ @a[ $_, $_ + 1 ] ] : () } 0 .. $#a;
- show @D;
- my @E = map $_ & 1 ? () : [ @a[ $_, $_ + 1 ] ], 0 .. $#a;
- show @E;
- # destructive
- my @b = 1 .. 8;
- my @F = map [ splice @b, 0, 2 ], 0 .. $#b / 2;
- show @F;
- # destructive
- @ARGV = 1 .. 8;
- my @G = map [ shift, shift ], 0 .. $#ARGV / 2;
- show @G;
- # stupid
- my @H = map [split], "@a" =~ /\S+\s\S+/g;
- show @H;
复制代码 PART 2: 简约低调有内涵- # cool
- my @a = 1 .. 8;
- # my @I = ... [[ read PART2.pl ]]
- # show @I;
复制代码 PART2: [ 优惠价格 : 50 积分 ]
代码只有 1 行。
建议: 速度变身高大上小伙伴们快来 购买 吧 !!
PART2.pl.zip
(310 Bytes, 下载次数: 2, 售价: 50 可用积分)
|
|