There's more than one way to do things | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I think the point is: the form that produces your input has a fixed number of possible fields, and you should know what all these fields are (at least, what they are called), because you would see all those field names whenever the form is filled in completely with nothing left blank.
Your problem arises when some fields are not filled in, so their names don't show up at all in the form submission -- you have to know what they are in advance of receiving a given submission, so that you can figure out when they are missing. So, given that there is a finite, maximum set of fields as defined by the complete form, you should change this line in the OP code: to be something like this: where each "FieldnameN" represents an actual name of a parameter key coming from the form, the array contains the complete set, and the names are in the desired order for printing to the log file. Then your loop over the key names would go something like this: though personally I prefer concatenating fields into a line string, and printing the line: Note that the "defined()" check is simply there to avoid warnings about string operations on undefined values, in case you happen to have "-w" or "use warnings" in your script (which is generally a good idea). Then the regex match allow any value containing non-whitespace to get into the log file. In reply to Re^3: Add Null values to my FlatFile
by graff
|
|