Jeff 'japhy' Pinyan wrote:
On Aug 10, Tim McGeary said:


I have a file of data that I want to safety check to ensure that there
is data for each piece of the line being split.  Is there a fast way to
say "If any of these are '' then write to error log"?


Assuming you store the data in an array, you can simply say:

  if (grep length == 0, @data_members) {
    print LOG "error: empty fields found in this dataset\n";
  }

Something to that effect should work.

follow-up question: will this only be true if $item of @array is completely empty? This is the type of data for each $item of @array:


ID, name_f, name_l, email, id, contact, group, member

I am splitting this by commas into different $scalers to manipulate. And I know that same of these fields are empty (to which I need to report back to the people sending me the data). It will NEVER happen that a whole line is empty, but just one or two of the fields in each line.

Does that change the scope of this suggestion?



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to