列表实用工具集。
#!/usr/bin/perl
use List::Util qw/max min sum maxstr minstr shuffle/;
@s = ('hello', 'ok', 'china', 'unix');
print max 1..10; #10
print min 1..10; #1
print sum 1..10; #55
print maxstr @s; #unix
print minstr @s; #china
print shuffle 1..10; #radom order
本文展示了一个使用Perl语言的List::Util模块进行列表操作的示例代码。该示例演示了如何对数字和字符串列表执行最大值、最小值、求和及随机排序等常见操作。
1万+

被折叠的 条评论
为什么被折叠?



