View Problem

Fetch an element of a list by index

Given the list [One, Two, Three, Four, Five], fetch the third element ('Three')
DiskEdit
perl
qw(One Two Three Four Five)[2];
DiskEdit
perl
@list = qw(One Two Three Four Five);
$list[2];
ExpandDiskEdit
java
String result = list.get(2);
ExpandDiskEdit
groovy 1.0+
list = ['One', 'Two', 'Three', 'Four', 'Five']
result = list[2] // index starts at 0

Submit a new solution for perl, java, or groovy
There are 21 other solutions in additional languages (clojure, cpp, csharp, erlang ...)