in reply to Re: Re: Out-commenting and formating challenge
in thread Out-commenting and formating challenge

Please, be more specific. "It doesn't work" may be correct, but is far from helpful. Give any error messages, and both the output the program gives you and the output you expect.
Also, your code segment suggests that you want to do something different from what your example suggests. The example just suggests replacing the space in front of om(1001... by a comma, whereas the code snippet suggests that you want to put everything after the /apost part in double quotation marks, which is almost exactly what you asked for above. What problem do you exactly have with my code above? Does it not work for your problem? If so, please give information on what deviated from the expected behaviour and I will try to help fixing it. Do you have problems understanding the code? Tell me and I will try to explain. Do you want to do something different after all? Then please be more specific.

To your code:
The first problem is in the first line: You did not escape the slash, but instead the paren. Therefore, the slash in front of apost is considered the end of the regex by Perl and you will probably get a syntax error, because Per does not have an idea whatsoever what you mean by the third slash.
Second problem (substitution): You cannot use a regex as a substitution string. That is, you can try, but you will get the string instead of what it matched before. And again, the slash is escaped improperly.

Again: Think about what you want to ask before you post. Hit the preview button and then ask yourself: "If I had no idea about the problem, would I understand my question completely?". If the answer is "No", and it should have been that for your last couple of posts, then rephrase the question until you consider it understandable.
And please, follow the links above and look at the articles. Also, you might want to buy some standard Perl books, such as Programming Perl (the Perl bible), Learning Perl (a very good, quick and comprehensive introduction which you really should consider reading) and Mastering Regular Expressions (which might help you with your regex problems). Take the time to read them and play a bit with the examples before you try to write your own code.

Please understand that we are trying to help you, but the level of difficulty ranges between "Very Hard" and "Impossible" if you cannot give us an understandable description of your problem.

Cheers,
CombatSquirrel