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?

  • 2
    \$\begingroup\$ 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. :-) \$\endgroup\$ Commented Mar 26, 2014 at 4:35
  • \$\begingroup\$ @ChrisJester-Young: Thank you for your input. \$\endgroup\$
    – Dennis
    Commented Mar 26, 2014 at 4:54
  • \$\begingroup\$ 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! \$\endgroup\$
    – Shaggy
    Commented May 9, 2017 at 17:32

1 Answer 1


If I have a solution in a different language, I would post a second answer. So would I do, if I have an answer in the same language, but involving a totally different algorithm/technology/way of doing things.
But that's just my opinion, and how I do things.

You might pick options 1 or 3. There isn't really a point in deleting an answer just because it's not short. As long as it's valid, and actually golfed, it should stay.

  • \$\begingroup\$ 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. \$\endgroup\$
    – Dennis
    Commented Mar 26, 2014 at 15:33
  • \$\begingroup\$ I ended up deleting the Bash solution, but I'll follow your advice and post a separate answer next time. \$\endgroup\$
    – Dennis
    Commented Mar 26, 2014 at 20:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .