I am not a Perl expert, but have a question about the join operator. Lets say I want to delete all multiline comments in a c/c++ source file. Also suppose my record separator is the default newline.
This is how I would do it: read all the lines from the file into a list. The lists elements represent the lines in the source separated by \n. I then use join to combine all the lines into one big string. Then I use regex substitution to replace all /*.....*/ with blank. At least that is how I would do it.
My main concern is whether it is sensible to use join in this way with respect to memory usage. Is join inherently inefficient? I have not seen many C source files > 10 MB; I might have to do something similar for larger XML files perhaps.
Any better ideas to remove multi line comments from a c source?