in reply to Efficient way to do field validation

What have you tried? We expect you to tell us what you've been doing, so we can help you learn. This is not code-for-free.com; if you're merely looking for someone to provide code, you may want to see if they're up.

And you definitely have tell us why the first decimal value, "11.00" fails your notion of validation -- apparently because the length doesn't match the max digit or decimal digit counts in the spec "decimal(5,3)" -- while the name "BILL" passes but clearly isn't the max of "varchar(5)".

OTOH, it looks to me as though you can solve most of the rest of your problem by reading perldoc -f length and or perldoc perlre with specific reference to quantifiers.

My apologies to all those electrons which were inconvenienced by the creation of this post.

Replies are listed 'Best First'.
Re^2: Efficient way to do field validation
by govindkailas (Acolyte) on Jul 31, 2013 at 14:00 UTC
    I am not here for asking how to validate the fields. Neither I am expecting code-for-free. As I mentioned in the original post I am selecting and validating each field using appropriate regex. What I am looking for is a better method to do the validation - something similar to c++ class definition. Can we have a hash defined with specific regex keys and check if the value match ?
      Yes.

      Update (after keeping my peace long enough to reach a slow burn):

      What you said about validating in the OP was "Now how should I validate each fields ?" which I don't read as congruent with "(a)s I mentioned in the original post I am selecting and validating each field using appropriate regex" as you're now asserting.

      Yes, you stated that you were splitting the record into "columns and taking it to variables." -- again, a statement at some remove from your new version .

      So yes, I'm taking offense at your reply, as you did at my reply -- an attempt to point out two obvious ways to do some form of validation (and a request that you provide your criteria for determining if an entry is valid). It's not, IMO, a gracious response to an attempt to help with what appeared to be a noob question.... posed in the manner of someone who hasn't read On asking for help and How do I post a question effectively?. (Without your code, it's hard to guess if one can provide a more efficient was to do field validation.)

        I didnt wanted to offend you, that was not my intention. Sorry for that.