line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Math::MultiplicationTable;
|
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
27985
|
use 5.008008;
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
43
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings;
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
311
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter;
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @ISA = qw(Exporter);
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export
|
12
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead.
|
13
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants.
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# This allows declaration use Math::MultiplicationTable ':all';
|
16
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
|
17
|
|
|
|
|
|
|
# will save memory.
|
18
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw(
|
19
|
|
|
|
|
|
|
) ] );
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our @EXPORT = qw(
|
24
|
|
|
|
|
|
|
);
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our $VERSION = '0.01';
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=item generate()
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Generate 9 * 9 cells table as plain text.
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=item generate($size)
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Generate $size * $size size multiplication table as plain text.
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub generate
|
41
|
|
|
|
|
|
|
{
|
42
|
5
|
100
|
|
5
|
1
|
23
|
my $size = (defined $_[0]) ? $_[0] : 9;
|
43
|
5
|
|
|
|
|
8
|
my $ret = '';
|
44
|
5
|
100
|
|
|
|
18
|
return undef if ($size < 0);
|
45
|
4
|
100
|
|
|
|
16
|
return $ret if ($size == 0);
|
46
|
|
|
|
|
|
|
|
47
|
3
|
|
|
|
|
23
|
my $figure = int(log($size ** 2) / log(10)) + 2;
|
48
|
3
|
|
|
|
|
8
|
foreach my $r (1 .. $size){
|
49
|
109
|
|
|
|
|
169
|
foreach my $c (1 .. $size){
|
50
|
9883
|
|
|
|
|
18737
|
$ret .= sprintf "%".$figure."d", $r * $c;
|
51
|
|
|
|
|
|
|
}
|
52
|
109
|
|
|
|
|
262
|
$ret .= "\n";
|
53
|
|
|
|
|
|
|
}
|
54
|
|
|
|
|
|
|
|
55
|
3
|
|
|
|
|
88
|
return $ret;
|
56
|
|
|
|
|
|
|
}
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1;
|
59
|
|
|
|
|
|
|
__END__
|