This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use 5.010; | |
use strict; | |
use warnings; | |
use Data::Dumper; | |
use Woothee; | |
say Dumper (Woothee->parse("Mozilla/5.0 (Linux; U; Android 4.0.3; ja-jp; Sony Tablet S Build/TISU0R0110) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30")); | |
say Dumper (Woothee->parse("Mozilla/5.0 (Linux; U; Android 4.1.1; ja-jp; Galaxy Nexus Build/JRO03H) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
# 戦略1: 10だけ大きくした配列を作る戦略 | |
my $array_ref =[('undef') x 10]; | |
my $count = count(); | |
run($ARGV[0]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use Benchmark qw(:all); | |
sub powmod1_1 { | |
my ($a, $k, $m) = @_; | |
my $t = 1; | |
for (my $i = 0; $i < $k; $i++){ | |
$t = ($t * $a) % $m; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
warn "結果:", powmod(2,10,5); | |
sub powmod | |
{ | |
my ($a, $k, $m) = @_; | |
warn "powmod a:$a, k:$k, m:$m"; | |
if (int $k == 0){ return 1; } | |
my $t = powmod($a, $k /2, $m); |