X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FNum2text.pm;h=15575c356138ce4e6950c18d0be503a0c3058723;hb=706d20f46c3e638de6ffca27e0fbdd48394b24ab;hp=7c05ef0151f9abfdb7bdbef6656d2c6372c4c111;hpb=d319704a66e9be64da837ccea10af6774c2b0838;p=kivitendo-erp.git diff --git a/SL/Num2text.pm b/SL/Num2text.pm index 7c05ef015..15575c356 100644 --- a/SL/Num2text.pm +++ b/SL/Num2text.pm @@ -32,6 +32,8 @@ # #===================================================================== +use strict; + sub init { my $self = shift; @@ -86,16 +88,16 @@ sub num2text { while (@num) { @a = (); - for (1 .. 3) { - push @a, shift @num; + for (1..3) { + push(@a, shift(@num)); } - push @numblock, join / /, reverse @a; + push(@numblock, join(" ", reverse @a)); } while (@numblock) { $i = $#numblock; - @num = split //, $numblock[$i]; + @num = split(//, $numblock[$i]); if ($numblock[$i] == 0) { pop @numblock; @@ -105,10 +107,10 @@ sub num2text { if ($numblock[$i] > 99) { # the one from hundreds - push @textnumber, $self->{numbername}{ $num[0] }; + push(@textnumber, $self->{numbername}{ $num[0] }); # add hundred designation - push @textnumber, $self->{numbername}{ 10**2 }; + push(@textnumber, $self->{numbername}{ 10**2 }); # reduce numblock $numblock[$i] -= $num[0] * 100; @@ -120,24 +122,24 @@ sub num2text { if ($numblock[$i] > 9) { # tens - push @textnumber, $self->format_ten($numblock[$i]); + push(@textnumber, $self->format_ten($numblock[$i])); } elsif ($numblock[$i] > 0) { # ones - push @textnumber, $self->{numbername}{ $numblock[$i] }; + push(@textnumber, $self->{numbername}{ $numblock[$i] }); } # add thousand, million if ($i) { - $num = 10**($i * 3); - push @textnumber, $self->{numbername}{$num}; + my $num = 10**($i * 3); + push(@textnumber, $self->{numbername}{$num}); } - pop @numblock; + pop(@numblock); } - join ' ', @textnumber; + join(' ', @textnumber); } @@ -145,7 +147,7 @@ sub format_ten { my ($self, $amount) = @_; my $textnumber = ""; - my @num = split //, $amount; + my @num = split(//, $amount); if ($amount > 20) { $textnumber = $self->{numbername}{ $num[0] * 10 };