Hello,

I'm new to this list and pretty much an absolute perl
beginner. I'm really enjoying the list and would
appreciate a little insight into the true meaning of
'while'. For some reason I'm having trouble using it.

I was working on something today to help me find bad
data in a text file. Among other things, I wanted the
program to make a list of empty fields (This is easy
to do with the database, but I wanted the program to
look for other warning signs, like phone nubmers that
contain all zeroes, so I thought it would be nice to
make it find the nulls too). I tried something like
this (note: I didn't finish this program, and I don't
think it entirely makes sense):

foreach $field (@fld_vals) {
        while ($field = '') {
                push (@nulls,$id);
        }
}

My idea was that $id would be, for instance, the
primary key value so that I could go look at the
record later. 

Well, it didn't do what I wanted, but what really
confuses me is what it actually did. When I went
through the program in the debugger, it looked like my
while statement was actually _assigning_ '' to each
element of @fld_vals, thereby erasing the data in that
array.

Can anyone tell me why it did this?

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

Reply via email to