perl 中用shell.pm調用shell指令
code:
#!/usr/bin/perl -w
use strict;
use Shell qw/webbench/;
my @array = ();
open FILE,'<','url.txt' or die "$!\n";
while (<FILE>) {
chomp;
/(\S+)/;
push @array,$1;
}
close FILE;
while (1) {
for my $url (@array) {
my $sh = Shell->new;
print $sh->webbench("-c 500 -t 60 $url");
}
sleep 5
本文轉自dongfang_09859 51CTO部落格,原文連結:http://blog.51cto.com/hellosa/507906,如需轉載請自行聯系原作者