in reply to Reg exp questions
my $str = "(foo + bar)\n(baz * quux)\n"; # opening and closing parens and space => underscore $str =~ tr/() /_/; # newline => space $str =~ tr/\n/ /; print "<<$str>>\n"; [download]
<<_foo_+_bar_ _baz_*_quux_ >> [download]