Tony Esposito wrote:
Does tr/'\n'/' '/
Replace every ' with ' and every "\n" with " " and every ' with '. Should probably just be tr/\n/ /.
do the same as tr/'\n'/' '/g?
I assume you mean s/'\n'/' '/g because /g is not a valid option for tr///. That will replace the string "'\n'" with the string "' '" globally but I assume you meant s/\n/ /g.
( replace newline with space ) If so, is one preferred over the other?
tr/// is usually more efficient (faster) than s///g. Unless you really meant to use the string "'\n'" because tr/// cannot do strings, just characters.
John -- The programmer is fighting against the two most destructive forces in the universe: entropy and human stupidity. -- Damian Conway -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/