E. Alan Hogue schrieb am 2001-05-30, 20:56:
Instead of this:
> foreach $field (@fld_vals) {
> while ($field = '') {
you want that:
==
while ($field == '') { # '==' for ints, 'eq' for strings
> push (@nulls,$id);
> }
> }
>
[...]
> while statement was actually
"E. Alan Hogue" wrote:
>
>
> foreach $field (@fld_vals) {
> while ($field = '') {
i think u want an 'if' here. when you use a 'while', the
program continues to loop if the condition is true. this
usually implies you will do something to change the
condition within the loop. since you a
> foreach $field (@fld_vals) {
Means, iterate through @fld_vals. For each
cell, make $field be an alias to that cell, then
do the bracketed code that follows.
So, if you assign to $field in the code that
follows, you assign to the cell in the array too.
The code gets done once for each cell.
>
On Wed, 30 May 2001, E. Alan Hogue wrote:
...
> 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
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