use Bio::Phylo::Parsers; my $parser = new Bio::Phylo::Parsers; my $collection = $parser->parse( -format => $format, -file => $filename , -I_want => qw/ trees / ); # I_want is optional for my $obj (@$collection) { .... }