http://www.perlmonks.org?node_id=1064287


in reply to Storing multiple value field in a MySQL database

There have been a number of replies now that give a more "ideal" solution. But let's take the OP at face value (as reinforced by a later comment) and accept that he has restrictions that preclude the "better" solutions.

Doing that yields the simpler (but not "ideal" from a DB perspective) of this:

my $memberstr = join('|',@member);

One should probably trim any possible leading and/or trailing whitespace just to be safe. Is this an ideal solution? No. Can it be converted to a better solution later if desired? Yes, and without much hassle.

So rather than point all the problems that the OP has with this (at great length in some cases) just take the OP at his word that he understands all of this and appears to have restrictions that dictate that the less than ideal solution be used.

It helps to remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.

Replies are listed 'Best First'.
Re^2: Storing multiple value field in a MySQL database
by itnomad (Scribe) on Nov 27, 2013 at 18:57 UTC

    Well said, boftx. I run into columns that have multiple values separated by commas now and then. It works fine and would be easy to refactor if need be.