EPrints Technical Mailing List Archive
Message: #00840
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
[EP-tech] Re: Random question: Eprint core fields
- To: eprints-tech@ecs.soton.ac.uk
- Subject: [EP-tech] Re: Random question: Eprint core fields
- From: Yuri <yurj@alfa.it>
- Date: Thu, 05 Jul 2012 09:16:59 +0200
Il 04/07/2012 17:19, Sebastien Francois ha scritto:
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! :-))
->[0] is orrible and unthinkable :-)
Perhaps you're confusing array and array refs: my @array = ( 'hello', 'world' ); my $arrayref = [ 'hello', 'world' ];
I thought they was the same! :-o
# both prints 'hello': print $array[0]; print $arrayref->[0];
Thanks for the precious info! I've still a lot to learn about perl. I love python but perl can still do a lot :-P
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 :-)*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech *** Archive: http://www.eprints.org/tech.php/ *** EPrints community wiki: http://wiki.eprints.org/
- References:
- [EP-tech] Random question: Eprint core fields
- From: John Salter <J.Salter@leeds.ac.uk>
- [EP-tech] Re: Random question: Eprint core fields
- From: Ian Stuart <Ian.Stuart@ed.ac.uk>
- [EP-tech] Re: Random question: Eprint core fields
- From: Sebastien Francois <sf2@ecs.soton.ac.uk>
- [EP-tech] Re: Random question: Eprint core fields
- From: John Salter <J.Salter@leeds.ac.uk>
- [EP-tech] Re: Random question: Eprint core fields
- From: Yuri <yurj@alfa.it>
- [EP-tech] Re: Random question: Eprint core fields
- From: Sebastien Francois <sf2@ecs.soton.ac.uk>
- [EP-tech] Random question: Eprint core fields
- Prev by Date: [EP-tech] Re: Random question: Eprint core fields
- Next by Date: [EP-tech] Re: Random question: Eprint core fields
- Previous by thread: [EP-tech] Re: Random question: Eprint core fields
- Next by thread: [EP-tech] Re: Random question: Eprint core fields
- Index(es):