Quick mod for PERL expert
Hi there, thanks for looking at our project! This is a quick one.
Our web site runs a PERL script ([url removed, login to view]) for its search function. The script works with a tab delineated text flat file database. The script outputs search results to an HTML template file, which contains "placeholders" -- for example, an placeholder of ##6## would be where the script returns field 6 of a record. I believe this is pretty typical for PERL.
What we need is simple -- field 6 of our database is "price", and the database stores this as an unformatted value -- so that for example, a price of $10,995 is actually 10995 in our database. Currently, this is what the script returns in search results -- so someone looking at vehicle prices on our site sees them as, for example, $15945 and $45250 and $109500.
What we need is a simple modification to our script which will allow it to format prices with a proper
"thousands" comma. So a price of 10590 would be written as 10,950, and a price of 125900 would be
written as 125,900. (There's no need to worry about a "$", our result template adds that automatically).
Specifically we need the script to do as follows: If field 6 (price) is an integer above 9999 and below 100000, the script should put a comma (",") beween digit 2 and digit 3 of the field 6 value on the result HTML template. If field 6 (price) is an integer above 99999, the script should put a comma (",") between digit 3 and digit 4 of the field 6 value on the result HTML template. Prices of 9999 and below should remain unaltered (without commas).
I believe this would require only a few lines of code. However, because this script is absolutely central and mission-critical to our site, so we need an experienced PERL expert to do this one -- the modification needs to be done in such a way that none of the other functions of the script are affected. The script should continue to work in exactly the same way as before, with the exception of this modification of the way that it writes results on one field. It should also not cause the data itself, in the database, to be modified in any way. PHP/MySQL solutions are likewise not appropriate for what we need here.
We would ask that you please comment the modification very clearly, so that we can also apply it to two other cloned copies of the [url removed, login to view] script which are in the same directory and are also use on our site.
Thank you for taking the time to read our project, and if you're an experienced PERL coder, we look forward to working with you on this quick little project.