# Second answer for second language?

A few days ago, I answered Find the odd character out in a pattern with a bash script.

Today, my answer was outscored by somebody else. Since all the heavy lifting was done by PCREs anyway, I decided to port my bash-grep-sed-grep approach to Perl, which managed to save quite a few characters. So far, so good.

What I'm wondering is if I did good in editing my answer to incorporate the second solution. I chose to do so since the approach is basically the same, just the language changed. But now that I did it, it just feels messy.

The answer has gotten a little bit bloated (it was quite long anyway), I literally wrote things like How this is achieved is explained in the bash version below. and I can't further golf any of the two solutions without modifying the other solution as well.

So, what do I do now?

• Split the answer in two? If so, which solution do I move out of the existing answer?

• Delete the bash solution entirely? It's a lot longer than the Perl solution anyway.

• Keep editing and leave things as they are?

• I'd probably go for option 2, but that's just my personal opinion and I'm not speaking as a moderator in this instance. :-) – Chris Jester-Young Mar 26 '14 at 4:35
• @ChrisJester-Young: Thank you for your input. – Dennis Mar 26 '14 at 4:54
• I'd say option 1, editing the newer version out of the existing answer into its own answer. I know I'm still new here but the way I approach it is to post a separate answer if either the language is different or the approach differs significantly enough. That way, each solution can be judged on its own merits and up/down-voted accordingly. EDIT: I should have scrolled down to read the answers before posting! – Shaggy May 9 '17 at 17:32

• Posting a second answer is what I should have done in the first place; I will do so next time. By now, the answer got two upvotes before and two after incorporating the second solution, so splitting it feels like misrepresenting the vote count. I got to a point where I can't apply the optimizations of the Perl version to the Bash version (the new regex exceeds grep -P's backtracking limit), so the shortest Bash version I can come up with passing the Perl script as an argument to perl -nE. – Dennis Mar 26 '14 at 15:33