From: benjohn@... Date: 2007-01-17T18:30:49+09:00 Subject: String pleasure (was: [ANN] Getopt/Declare v1.20) The library looks groovy. But I never knew that block quoted strings worked like this: > args = Getopt::Declare.new(<<'EOF') > -q, --quiet quiet > -f, --files ... input files > -n, --number a float number > -i, --integer an integer number > EOF That's just completely cool! And it also makes a lot of sense: I think I'll actually remember it now. You can do somethin like this: irb(main):008:0> puts <<'STRING_END'.gsub('a') {'XXX'} irb(main):009:0' bab irb(main):010:0' aba irb(main):011:0' STRING_END bXXXb XXXbXXX You can even do this (discovered just now in one of those, "surely this wont work too, will it?" Ruby moments)!... irb(main):015:0> puts <