in reply to Reg exp questions

When you want to replace just characters, use the tr operator (simpler and faster than s///):
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";
Output:
<<_foo_+_bar_ _baz_*_quux_ >>