#! /usr/bin/perl
use strict;
open FH, "list" or die("can't not open hotlist.txt\n");
my $count=0;
my @hash=();
while (my $myline = <FH>) {
chomp $myline;
$hash[$count]=$myline;
$count++;
}
close FH;
#####1.按$count-1取随机数$rand . 2.输出 hash($rand) 3.干掉hash($rand) 4.$count--
for(my $i=$count-1;$i--;$i>=0)
{
my $num= int (rand($i));
print $hash[$num],"\n";
splice(@hash,1,1);
}
从大数据列表中随机不重复列出所有数据
最新推荐文章于 2024-01-11 20:29:35 发布