[EP-tech] Re: Random question: Eprint core fields
Sebastien Francois
sf2 at ecs.soton.ac.uk
Wed Jul 4 16:19:39 BST 2012
Yuri,
This will work:
print $eprint->get_value( 'creators' )->[0];
Or:
print $eprint->get_value( 'creators' )->[0]->{name}->{given};
(but that's not very pretty! :-))
Perhaps you're confusing array and array refs:
my @array = ( 'hello', 'world' );
my $arrayref = [ 'hello', 'world' ];
# both prints 'hello':
print $array[0];
print $arrayref->[0];
Seb.
On 04/07/12 16:12, Yuri wrote:
> I agree. I perl you can have an array, but [0] return error. If you
> cicle on it, you get the results.
>
> You can try it with $eprint->get_value( 'creators' )[0]<- does not work
>
> returning $eprint->get_value( 'creators' ) gives an ARRAY *hex number*
>
> foreach my $c ( @{$creators} )
>
> works.
>
> I don't know why :-)
More information about the Eprints-tech
mailing list