RobertCraven has asked for the wisdom of the Perl Monks concerning the following question:
or<accession>P41933</accession>
XML::Simple returns an array if there is more than one element and an scalar if only one.<accession>P41932</accession> <accession>Q21537</accession>
If of interest, the XML files can be viewed here:my $id; if(@{$HRdata->{'entry'}->{'accession'}}){ $id = $HRdata->{'entry'}->{'accession'}->[0]; } else{ $id = $HRdata->{'entry'}->{'accession'}; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: check if variable is an array
by moritz (Cardinal) on Jan 31, 2009 at 18:36 UTC | |
|
Re: check if variable is an array
by toolic (Bishop) on Jan 31, 2009 at 18:09 UTC | |
by RobertCraven (Sexton) on Jan 31, 2009 at 18:31 UTC |