#!/usr/bin/perl #ex2 use warnings; use strict; sub clust; $main::hd=[[] , [0.25], [0.25,0.5], [1,0.75,0.75]]; $main::hdt = 0.4; &clust; for ($loop::i=0; $loop::i<=3; $loop::i++) { print $clust::cluster_ids->[$loop::i], "\n"; } sub clust { use Algorithm::Cluster::Thresh; use Algorithm::Cluster qw/treecluster/; $clust::tree = treecluster(data=>$main::hd, method=>'a'); $clust::cluster_ids = $clust::tree->cutthresh($main::hdt); }