【Perl 】初心者コーナーPart5

このエントリーをはてなブックマークに追加
754名無しさん@お腹いっぱい。
#!/usr/bin/perl
use Benchmark;

#1

$t1 = new Benchmark;
code;
$t2 = new Benchmark;
print "the code took:", $t2->timediff($t1)->timestr, "\n";

#2
$count = 10000;
timethese( $count, {
foo => sub{ code1 },
bar => sub{ code2 },
});

__END__