mbethke:
- The first (++) is, indeed a "potential" disadvantage... but it is easily remedied if the need arises. In any case, slurping the file is not the point; use of a regex to ID files is.
- The second -- IMO -- is pretty much specious. Did you try inserting a "format violation" (or several)?
The only decimal cases which effect the output that I've discovered are
1) a record which consists solely of a number (clearly, a case which is cause for concern) or
2) a number using a thousands separator. (Admitted: I followed the sample data, but, as you can see from the regex, numbers with 4 or more digits satisfy the test so long as any thousands separator is omitted. And if it's present, the regex needs minor modification, followed by a function to remove the offending punctuation.
If the first is a case to worry about, spit out the entire record whenever a number satisfies the test. If the latter, the data is sufficiently suspect that its content should be validated... which is a different kettle of fish. So too is the case in which the numbers are binary or or octal or hex or lakhs or ....
But, again, illustrating all that seemed OT to me; TIMTOWTDI is the point.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.