程嶏清单9-16.txt
来自「< linux网络编程工具>>配套源码」· 文本 代码 · 共 20 行
TXT
20 行
@lists = (
[ 'just one thing' ],
[ qw(Mutt Jeff) ],
[ qw(Peter Paul Mary) ],
[ 'To our parents', 'Mother Theresa', 'God' ],
[ 'pastrami', 'ham and cheese', 'peanut butter and jelly', 'tuna' ],
[ 'recycle tired, old phrases', 'ponder big, happy thoughts' ],
[ 'recycle tired, old phrases', 'ponder big, happy thoughts', 'sleep and dream peacefully' ],
);
sub commify_series {
my $sepchar = grep(/,/ => @_) ? ";" : ",";
(@_ == 0) ? '' :
(@_ == 1) ? $_[0] :
(@_ == 2) ? join(" and ", @_) :
join("$sepchar ", @_[0 .. ($#_-1)], "and $_[-1]");
}
foreach $aref (@lists) {
print "The list is: " . commify_series(@$aref) . ".\n";
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?