in reply to TMTOWTDI isn't best in this case

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.