Print list with index and use alternative to puts