Leser: 2
8 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package thousands;
sub new($) {
my ($class, $number) = @_;
my $self = [];
push @{$self}, $number;
return bless $self, $class;
}
sub thousand_points($) {
my $self = shift;
my $number = $self->[0];
my ($new_number, $comma) = split(/[,.]/, $number, 2);
$new_number = reverse $new_number;
$new_number =~ s/(\d{3})(?=\d)/$1./g;
return reverse($new_number).",".$comma;
}
1;
8 Einträge, 1 Seite |