Revision 181ce4f5
Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt
SL/Num2text.pm | ||
---|---|---|
86 | 86 |
|
87 | 87 |
while (@num) { |
88 | 88 |
@a = (); |
89 |
for (1 .. 3) {
|
|
90 |
push @a, shift @num;
|
|
89 |
for (1..3) {
|
|
90 |
push(@a, shift(@num));
|
|
91 | 91 |
} |
92 |
push @numblock, join / /, reverse @a;
|
|
92 |
push(@numblock, join(" ", reverse @a));
|
|
93 | 93 |
} |
94 | 94 |
|
95 | 95 |
while (@numblock) { |
96 | 96 |
|
97 | 97 |
$i = $#numblock; |
98 |
@num = split //, $numblock[$i];
|
|
98 |
@num = split(//, $numblock[$i]);
|
|
99 | 99 |
|
100 | 100 |
if ($numblock[$i] == 0) { |
101 | 101 |
pop @numblock; |
... | ... | |
105 | 105 |
if ($numblock[$i] > 99) { |
106 | 106 |
|
107 | 107 |
# the one from hundreds |
108 |
push @textnumber, $self->{numbername}{ $num[0] };
|
|
108 |
push(@textnumber, $self->{numbername}{ $num[0] });
|
|
109 | 109 |
|
110 | 110 |
# add hundred designation |
111 |
push @textnumber, $self->{numbername}{ 10**2 };
|
|
111 |
push(@textnumber, $self->{numbername}{ 10**2 });
|
|
112 | 112 |
|
113 | 113 |
# reduce numblock |
114 | 114 |
$numblock[$i] -= $num[0] * 100; |
... | ... | |
120 | 120 |
if ($numblock[$i] > 9) { |
121 | 121 |
|
122 | 122 |
# tens |
123 |
push @textnumber, $self->format_ten($numblock[$i]);
|
|
123 |
push(@textnumber, $self->format_ten($numblock[$i]));
|
|
124 | 124 |
} elsif ($numblock[$i] > 0) { |
125 | 125 |
|
126 | 126 |
# ones |
127 |
push @textnumber, $self->{numbername}{ $numblock[$i] };
|
|
127 |
push(@textnumber, $self->{numbername}{ $numblock[$i] });
|
|
128 | 128 |
} |
129 | 129 |
|
130 | 130 |
# add thousand, million |
131 | 131 |
if ($i) { |
132 | 132 |
$num = 10**($i * 3); |
133 |
push @textnumber, $self->{numbername}{$num};
|
|
133 |
push(@textnumber, $self->{numbername}{$num});
|
|
134 | 134 |
} |
135 | 135 |
|
136 |
pop @numblock;
|
|
136 |
pop(@numblock);
|
|
137 | 137 |
|
138 | 138 |
} |
139 | 139 |
|
140 |
join ' ', @textnumber;
|
|
140 |
join(' ', @textnumber);
|
|
141 | 141 |
|
142 | 142 |
} |
143 | 143 |
|
... | ... | |
145 | 145 |
my ($self, $amount) = @_; |
146 | 146 |
|
147 | 147 |
my $textnumber = ""; |
148 |
my @num = split //, $amount;
|
|
148 |
my @num = split(//, $amount);
|
|
149 | 149 |
|
150 | 150 |
if ($amount > 20) { |
151 | 151 |
$textnumber = $self->{numbername}{ $num[0] * 10 }; |
Auch abrufbar als: Unified diff
Kosmetik: Klammern um Funktionsaufrufe.