[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: [NEWBIE] Extract all occurences from a text
From:       Kristof Bastiaensen <kristof () vleeuwen ! org>
Date:       2004-04-23 13:39:13
Message-ID: pan.2004.04.23.13.43.24.149349 () vleeuwen ! org
[Download RAW message or body]

On Fri, 23 Apr 2004 05:08:00 -0700, David Alan Black wrote:

>> 
>> you could simply do:
>> 
>> lines=[]

This line has no effect, the Array will be discarded
at the next expression

>> open(filename) do |f|
>>  lines= f.grep your_regexp
>> end
> 
> Or even more simply:
> 
>   lines = open(filename).grep(regex)
> 

doesn't that leave the file open?


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic