EPrints Technical Mailing List Archive
Message: #00839
< 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: Robert Berry <robert.berry@liverpool.ac.uk>
- Date: Wed, 04 Jul 2012 16:27:38 +0100
It's because it returns an array reference, not an array. You can de-reference like this: $eprint->get_value( 'creators' )->[0]. Yuri <yurj@alfa.it> writes: > 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 :-) > > > Il 04/07/2012 16:57, John Salter ha scritto: >> It was more the coding-standards inconsistencies I was thinking about (hence the pedant hat). >> >> For you and I it doesn't matter. To someone picking up eprints, and perl as a new language, it could be confusing. >> >> -----Original Message----- >> From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Sebastien Francois >> Sent: 04 July 2012 15:45 >> To: eprints-tech@ecs.soton.ac.uk >> Subject: [EP-tech] Re: Random question: Eprint core fields >> >> Single quotes won't extrapolate a variable (and characters such as \n, >> \r) while double quotes will: >> >> my $var1 = 'hello'; >> my $var2 = '$var1 world'; >> my $var3 = "$var1 world"; >> >> print $var2; # will print<$var1 world> >> print $var3; # will print<hello world> >> >> Seb. >> >> On 04/07/12 15:36, Ian Stuart wrote: >>> On 04/07/12 11:49, John Salter wrote: >>> >>>> Also (if I put my pedant hat on, so feel free to ignore!), there's inconsistent use of quotes in that file: >>>> { name=>"contact_email", type=>"email", required=>0, can_clone=>0 }, >>>> VS. >>>> { 'name' => 'sword_depositor', 'type' => 'itemref', datasetid=>"user" }, >>> Perl knows that hash keys must be scalars, therefore assumes quotes. >>> Perl hash keys can be numeric scalars or string scalars, perl doesn't care. >>> >>> I also notice variation in the use of quotes within the same >>> declaration, and with the use of single- verses double-quotes on values :) >>> >>> Just goes to show how rich and helpful Perl is.... by not falling over >>> on the inconsequentials ;-) >> *** 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/ >> >> *** 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/ > > *** 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] 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):