[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] Re: Random question: Eprint core fields



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 :-)