If nothing else works I'll try using a different delimiter coming back from the database and then converting it back just after this step.

I think I would recommend doing that anyway, and doing it first. Something like a colon would be a good choice.

This has the advantage that you can easily (I assume) test it with positive numbers to ensure it doesn't break the old use cases, and no adjustment should be needed to handle negative numbers.

The fact that you need to "convert it back just after this step" implies that some other code will also need to extract the numbers again. That code also needs to be examined to see if it will cope with negative numbers, and my initial guess would be that it will not. I don't have enough information to guess if that code is later in the script that is under your responsibility, or in the code it hands off to.

Unless there are compelling reasons not to, I would recommend changing to a different delimiter for the later parts as well.


In reply to Re^3: split versus =~ by hv
in thread split versus =~ by russlo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.