# Selecting every last element of a nested list

I couldn't find a similar question so I decided to ask this one. I have a nested list with many sublists of equal length. To make things easier let's say it's like that:

list={{2,1,7},{3,9,5},{4,8,6}}


I'd like to get a list of last elements from each sublist, in this case:

{7,5,6}

I'm not sure whether i should think of a pattern to do this or is there a simpler way?

-
Here are a few options: 1. Last /@ list 2. list[[All, -1]] 3. list /. {___, i_Integer} :> i –  The Toad Jan 27 '14 at 16:53
list[[;; , -1]] –  RunnyKine Jan 27 '14 at 16:55
Transpose[list][[-1]] –  Pickett Jan 27 '14 at 16:55
That was fast - thanks guys! –  Wojciech Jan 27 '14 at 17:01

It is

list = {{2, 1, 7}, {3, 9, 5}, {4, 8, 6}};
list[[All, -1]]
(* {7, 5, 6} *)


or

Last /@ list
(* {7, 5, 6} *)

-
For beginners, the latter command is shorthand for Map[Last[#]&,list] –  Michael Stern Jan 27 '14 at 17:10
Actually Map[Last, list] –  Rojo Jan 27 '14 at 19:39
@Rojo Hehe... :-) –  halirutan Jan 27 '14 at 20:38