[Bioperl-l] help, please. newick.pm error
june tantoolvesm
june at ics.es.osaka-u.ac.jp
Thu Jun 10 09:32:42 EDT 2004
Wow, perfect! Thank you :)
june
> -----Original Message-----
> From: Aaron J. Mackey
> [mailto:amackey at pcbi.upenn.edu]
> Sent: Thursday, June 10, 2004 10:26 PM
> To: june tantoolvesm
> Cc: BioPerl
> Subject: Re: [Bioperl-l] help, please. newick.pm
> error
>
> It's rather subtle, but $neighbor_factory->run()
> returns either an
> array or array reference, depending on the context;
> you're calling it
> in scalar context, so it's returning an arrayref
> (the first element of
> which is the tree you want). In sum, change this
> line:
>
> my $tree = $neighbor_factory->run($matrix);
>
> To this:
>
> my ($tree) = $neighbor_factory->run($matrix);
>
> -Aaron
>
> P.S. Developer's note: I think this is a misuse of
> wantarray; typically
> the Perl idioms for context-sensitive returns is
> that scalar context
> implies I only want the "size of" or
> "truthness/success" of the result,
> not "package my results some other way than an
> array". Since neither
> "size of" nor "truthness" of a factory run method
> seems appropriate,
> I'd vote for culling this and similar uses.
>
> --
> Aaron J. Mackey, Ph.D.
> Dept. of Biology, Goddard 212
> University of Pennsylvania email:
> amackey at pcbi.upenn.edu
> 415 S. University Avenue office: 215-898-
> 1205
> Philadelphia, PA 19104-6017 fax: 215-746-
> 6697
More information about the Bioperl-l
mailing list