2010年7月15日星期四

Effective Perl Programming : Item 24-30

Item 25:
my ( $thousands_sep, $decimal_sep ) = do { 
if    ( $locale eq 'European' ) { qw( . , ) } 
elsif ( $locale eq 'English' )  { qw( , . ) }
};

Item 26:
use List::MoreUtils qw(pairwise);
my @c = pairwise { $a + $b } @a, @b;

use List::MoreUtils qw(each_array);
my $ea = each_array( @a, @b, @c );
my @d; 
while ( my ( $a, $b, $c ) = $ea->() ) {
push @d, $a + $b + $c; 
}

Item 27:
use autodie qw(open close);

Item 30:
\h 水平空白符
\N 非换行符

没有评论:

发表评论