Yes, it's really miserable when programmers don't adopt a solid set of standards and don't bother to group the business logic in one area. However, if these are all the ways you have this done, then your problem should be simple. Consider this code:

my $b = '7'; print "p{$b}.zip\np${b}.zip\np$b.zip";

That prints the following:

p{7}.zip p7.zip p7.zip

As you can see, when interpolating variables, ${b} and $b are the same (for this particular instance), so you won't have to check for both of them. However, p{$b} has the braces included in the string. In addition to MeowChow's nice fix, you could check file_format and if you don't have a format the genuinely matches /^p\{[^}]+\}\.zip$/, then you should be able to write a bit of code that patches the data. However, you'd then have to search through your code for anything that works with that table and is expecting the corrupted format.

I am wondering, though, why you have a SELECT * in the code. If you don't need all of the fields, it's wasteful. If you do need all of the fields, then someone adding, switching, or dropping fields could easily break the code if this is not properly accounted for. Further, even if you do need all of the fields, specifying the names of the fields makes the code more self-documenting.

HTH

Cheers,
Ovid

Vote for paco!

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.


In reply to (Ovid) Re: TMTOWTDI isn't best in this case by Ovid
in thread TMTOWTDI isn't best in this case by princepawn

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.