"Jim Freeze" <jim / freeze.org> schrieb im Newsbeitrag
news:20030425063643.A47876 / freeze.org...
> On Friday, 25 April 2003 at 19:18:40 +0900, Robert Klemme wrote:
> >
> > "Jim Freeze" <jim / freeze.org> schrieb im Newsbeitrag
> > news:20030425002319.A47026 / freeze.org...
> > > On Thursday, 24 April 2003 at 19:08:17 +0900, Robert Klemme wrote:
> > > >
> > >  Here's a common scenario that I use.
> > >  This file allows comments that start with '#'.
> > >  All other lines that are not empty are data.
> > >
> > >  def to_number(str)
> > >    Integer(str) rescue Float(str) rescue str
> > >  end
> > >
> > >  matrix = []
> > >  File.foreach(file) { |line|
> > >   next if /^\s*$/ =~ line
> > >   next if /^\s*#/ =~ line
> > >   matrix << line.strip.split(/\t/).collect { |i| to_number(i) }
> > >  }
> >
> > next if /^\s*(#.*)?$/ =~ line
> >
> > sorry, couldn't resist. :-)
>
> Sorry, I don't understand. Are you trying to capture the comment
> and then throw it away?

Yes, that's what he did. I just combined the two "next" lines into one.

    robert