The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#!/usr/perl/perl580/bin/perl 

use Algorithm::Cluster;

$^W = 1;
use strict;
use warnings "Algorithm::Cluster";

my $weight2 =  [ 1,1 ];

my $data2 =  [

	[ 1.1, 1.2 ],
	[ 1.4, 1.3 ],
	[ 1.1, 1.5 ],
	[ 2.0, 1.5 ],
	[ 1.7, 1.9 ],
	[ 1.7, 1.9 ],
	[ 5.7, 5.9 ],
	[ 5.7, 5.9 ],
	[ 3.1, 3.3 ],
	[ 5.4, 5.3 ],
	[ 5.1, 5.5 ],
	[ 5.0, 5.5 ],
	[ 5.1, 5.2 ],
];

my $mask2 =  [

	[ 1, 1 ],
	[ 1, 1 ],
	[ 1, 1 ],
	[ 1, 1 ],
	[ 1, 1 ],
	[ 1, 1 ],
	[ 1, 1 ],
	[ 1, 1 ],
	[ 1, 1 ],
	[ 1, 1 ],
	[ 1, 1 ],
	[ 1, 1 ],
	[ 1, 1 ],
];

my $data2_c1 = [ 0, 1, 2, 3 ];
my $data2_c2 = [ 4, 5, 6, 7 ];
my $data2_c3 = [ 8 ];

my $data3 =  [

        [ 1.1, 2.2, 3.3, 4.4, 5.5, ], 
        [ 3.1, 3.2, 1.3, 2.4, 1.5, ], 
        [ 4.1, 2.2, 0.3, 5.4, 0.5, ], 
        [ 12.1, 2.0, 0.0, 5.0, 0.0, ], 
];

my $mask3 =  [

        [ 1, 1, 1, 1, 1, ], 
        [ 1, 1, 1, 1, 1, ], 
        [ 1, 1, 1, 1, 1, ], 
        [ 1, 1, 1, 1, 1, ], 
];

my $weight3 =  [ 1,1,1,1,1 ];

my %params = (

	transpose =>         0,
	method    =>       'a',
	dist      =>       'e',
);

my ($distance);

$distance = Algorithm::Cluster::clusterdistance(

	%params,
	data      =>    $data2,
	mask      =>    $mask2,
	weight    =>  $weight2,
	cluster1  => $data2_c1,
	cluster2  => $data2_c2,
);

printf("Distance between 0 and 1 is %7.3f\n", $distance);

$distance = Algorithm::Cluster::clusterdistance(

	%params,
	data      =>    $data2,
	mask      =>    $mask2,
	weight    =>  $weight2,
	cluster1  => $data2_c1,
	cluster2  => $data2_c3,
);

printf("Distance between 0 and 2 is %7.3f\n", $distance);

$distance = Algorithm::Cluster::clusterdistance(

	%params,
	data      =>    $data2,
	mask      =>    $mask2,
	weight    =>  $weight2,
	cluster1  => $data2_c2,
	cluster2  => $data2_c3,
);

printf("Distance between 1 and 2 is %7.3f\n", $distance);

__END__