foreach my $dataset (sort keys %datasets) { my $ttest = new Statistics::TTest; $ttest->load_data(\@{$datasets{$dataset}[0]},\@{$datasets{$dataset +}[1]}); print "$dataset - t_prob:\t$ttest->{t_prob}\n\n"; undef @$ttest; # clear out old array data undef %$ttest; # get old hash data }