Thread Bitte um Hilfe für eine Studentin bei PERL Aufgaben!! (71 answers)
Opened by Anna_mary at 2010-06-20 14:34

pq
 2010-06-20 19:36
#138511 #138511
User since
2003-08-04
12209 Artikel
Admin1
[Homepage]
user image
Code (perl): (dl )
1
2
3
4
5
6
7
8
my @prices = (0.99) x 300;
my $sum = 0;
for (@prices) {
    $sum += $_;
}
print $sum;
__END__
297.000000000001

vs.
Code (perl): (dl )
1
2
3
print 0.99 * 300;
__END__
297
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 Bitte um Hilfe für eine Studentin bei PERL Aufgaben!!