2010/2/10 Sak .. <sak / proxectods.org>: > I have to process very very big text files and not line per line, I have > to access to a group of lines seperated for a "%". Then I tryed to > access line per line and detect the separator for each line saving the > lines in a buffer, obviously it works but it's very slow (text files are > bigger than 1GB). > > Perl have an awesome feature that is to change the separator for > iterating files (by default in all languages is "\n"), this simple and > extremely efficent code do what I need: > > $/ = "%"; > while ($article = <STDIN>) { > Iteration > } > > > I can write a equivalent code in ruby but not (by far) as efficient as > perl. Someone knows how can I change the separator for iterate the stdin > in ruby? STDIN.each_line("%") { |line| # iteration } Stefan