Thread Bequemer? (2 answers)
Opened by Gast at 2008-02-16 14:51

pq
 2008-02-16 15:00
#105976 #105976
User since
2003-08-04
12208 Artikel
Admin1
[Homepage]
user image
Gast+2008-02-16 13:51:54--
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
@liste = ($r,$f,$verfuegbar);

foreach (@liste) {

$_ = sprintf ("%.0f", $_);

$_ = reverse($_);
$_ =~ s/(\d\d\d)(?=\d)(?!\d*\,)/$1./g;
$_ = reverse($_);

}

## können die folgenden Zeilen komfortabler geschrieben werden?

$r = $liste[0];
$f = $liste[1];
$verfuegbar = $liste[2];

Code: (dl )
1
2
3
4
5
6
7
foreach ($r, $f, $verfuegbar) {

$_ = reverse sprintf "%.0f", $_;
$_ =~ s/(\d\d\d)(?=\d)(?!\d*\,)/$1./g;
$_ = reverse $_;

}
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem

View full thread Bequemer?