Thread Durchschnitt der Array Elemente (5 answers)
Opened by Ronnie at 2005-08-10 11:23

J-jayz-Z
 2005-08-10 13:08
#57103 #57103
User since
2005-04-13
625 Artikel
BenutzerIn
[Homepage] [default_avatar]
Code: (dl )
1
2
3
4
5
6
7
8
9
10
#!/usr/bin/perl
use strict;
use warnings;

my @zahlen = qw/18 19 20 23 21 19/;
my $sum = 0;
my $zahlen = scalar @zahlen;

$sum += $_ for @zahlen;
print $sum/$zahlen . "\n";
\n\n

<!--EDIT|J-jayz-Z|1123680011-->
perl -Mstrict -Mwarnings -e 'package blub; sub new { bless {} } sub bar {my $self=shift; $self->{bla}="5065726c2d436f6d6d756e697479"; return $self->{bla};} my $foo=blub->new();print "Hallo ";print pack("H*",$foo->bar()); print "\n"'

http://perl-tutor.de

View full thread Durchschnitt der Array Elemente