From: matt@... (Matt Armstrong) Date: 2001-04-15T07:53:49+09:00 Subject: [ruby-talk:13670] Question on gsub with a block First, is there any better way to read a whole file into a string variable than this: template = IO.readlines(@template, nil)[0] Second, I wanted code that replaces all strings "" with the return value of the XXX method. Is there any better way than the following to do this? I don't like having to repeat the regexp match to pull out the (\S+). page = template.gsub(/\/) { |s| if /\/ =~ s send($1) end } Any help is appreciated! -- matt