From: Joseph McDonald Date: 2001-10-20T15:51:34+09:00 Subject: [ruby-talk:22816] Re: PLease condense my code FM>> do_print = true FM>> ($<).each_line { |line| FM>> case line FM>> when /=begin/ then FM>> do_print = false FM>> when /=end/ then FM>> do_print = true FM>> when /=[-a-zA-Z0-9. ]*=/ then FM>> # do nothing FM>> else FM>> if do_print then FM>> puts line FM>> end FM>> end FM>> } JM> This one is a little shorter: JM> while gets JM> next if /=[-a-zA-Z0-9. ]*=/ JM> do_print = false if /=begin/ JM> do_print = true if /=end/ or do_print.nil? JM> print if do_print and not /=end/ JM> end Actually, does this one not work: while gets print if (!(/=begin/../=end/) && !(/^=[-a-zA-Z0-9. ]*=/)) end It is basically a copy of the perl version. -joe