From: Tristan Knowles Date: 2005-07-15T04:14:54+09:00 Subject: Re: Help: very simple script problem --- Daniel Berger wrote: > If you only want 1 line per iteration, then your > best bet is to use > IO.foreach. If you only want to slurp X number of > lines into a > variable, then just keep in mind that IO.readlines > returns an array. > So, you can use a range as the index and do: > > # No need to use the File class, btw > lines = IO.readlines(Log_File)[0..49] > > Just keep in mind that, even though you're only > selecting 50 lines, the > entire file has been slurped into memory. > Thanks again. IO.readlines(file)[a..b] worked a treat. I will have a look at foreach. Once i am able to understand the reference more easily, I'm sure the doors of opportunity will open up. For now, I know the logical way i want to do something, but I'm not sure the ways ruby allows it. So far its been so simple though, its great. Cheers. Tristan ___________________________________________________________ Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com