From: "Mauricio Fernández" Date: 2002-11-30T05:11:25+09:00 Subject: Re: loop starting not from beginning On Sat, Nov 30, 2002 at 04:57:32AM +0900, Phlip wrote: > ts wrote: > > >>>>>> "P" == Phlip writes: > > > > P> New question. What, if anything, is wrong with this? > > P> File.open("test").readlines.slice(5..-1) do |line| > > > > #slice don't take a block as argument :-) > > Apologies to the newbie, but I think ... each ... of the rest of us can > figure out how to fix that. In File.open("test").readlines.slice(5..-1).each do |line| ... end File.open is working as a sinonym of File.new, so the File will remain open, for the block is consumed by #each, not by #open. Now that last sentence sounds horrible! :P -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com After 14 non-maintainer releases, I'm the S-Lang non-maintainer. -- Ray Dassen