From: Tristan Knowles Date: 2005-07-18T19:52:10+09:00 Subject: Reading total lines of file then displaying in reverse? How would I use File or IO to read all the lines of a file, then display the contents in reverse? Its for a simple log reading script, which I would like to have read the total lines, then display with the latest entries first, and show x amount of log entries per page. I'm currently just dumping the whole, or part of the log with: ====== IO.readlines("my.log")[1..49].each_with_index do |line, index| ====== I guess I would have to count all lines, then assign a variable to the last number it counts, and then work in reverse from this variable... hmmm. I'm not sure:P Any ideas? ___________________________________________________________ How much free photo storage do you get? Store your holiday snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com