#!/usr/perl/perl580/bin/perl  -w

use Algorithm::Cluster qw/mean median/;

use strict;

my ($meanval, $medianval);
my @vals = (
    [ 34.3, 3, 2 ],
    [ 5, 10 ,15, 20 ],
    [ 1, 2, 3, 5, 7, 11, 13, 17],
    [ 100, 19, 3, 1.5, 1.4, 1, 1, 1],
    [ 3, 2 ],
    [ 0.1, 3.2, 2.3 ],
);


foreach (@vals) {
    $meanval   = Algorithm::Cluster::mean($_);
    $medianval = Algorithm::Cluster::median($_);
    print "Values are: (", join(", ", @$_), ")\n";
    printf("Mean is   %7.3f\nMedian is %7.3f\n\n", $meanval, $medianval);
}
