daz
7/18/2005 12:01:00 PM
Stefan Holst wrote:
> Tristan Knowles wrote:
> > How would I use File or IO to read all the lines of a
> > file, then display the contents in reverse?
>
> something like this?
>
> File.readlines("my.log").reverse.each{|l| puts l}
>
> RY
> Stefan
>
There's Array#reverse_each which would save an
unnecessary array reversal :)
File.readlines("my.log").reverse_each{|l| puts l}
daz