conditional statement: indicator not blank
Hi folks -- Don't know if this is a bug report or just a general FYI. I've been having trouble cleaning up 2nd indicators that aren't blank for 7xx fields. I was using the syntax in the Tutorial.pod doc: if ($field_7xx->indicator(2) != ' ') { $field_7xx->update( ind2 => ' ' ); } However, this was failing to match 2nd indicator 0 (zero), which is definitely different from blank. I tried the following variations to no avail: * != '' (no space) * != ' ' (with space) * != undef * != null * != '#' * !- '_' I ended up having to use the following, which achieved the desired effect with any of the above in the first slot: if ($field_7xx->indicator(2) != '' || $field_7xx->indicator(2) == 0) { Thanks, -Corey -- Corey A Harper Metadata Services Librarian Bobst Library, B42-LL1 New York University 70 Washington Square South New York, NY 10012 212.998.2479 [EMAIL PROTECTED]
RE: conditional statement: indicator not blank
On Monday, April 30, 2007 2:18 PM, Corey Harper wrote: >I tried the following variations to no avail: >* != '' (no space) >* != ' ' (with space) >* != undef >* != null >* != '#' >* !- '_' > >I ended up having to use the following, which achieved the desired >effect with any of the above in the first slot: > >if ($field_7xx->indicator(2) != '' || $field_7xx->indicator(2) == 0) { Would it not be better to use string comparison operators, ne and eq, since indicators may not necessarily be numeric? Please correct me if I am wrong. Bryan Baldus [EMAIL PROTECTED] [EMAIL PROTECTED] http://home.inwave.com/eija
Re: conditional statement: indicator not blank
Doh - thanks! My carelessness chalked up to Monday morning. Thanks to all who pointed this out on and off list! -Corey Bryan Baldus wrote: On Monday, April 30, 2007 2:18 PM, Corey Harper wrote: I tried the following variations to no avail: * != '' (no space) * != ' ' (with space) * != undef * != null * != '#' * !- '_' I ended up having to use the following, which achieved the desired effect with any of the above in the first slot: if ($field_7xx->indicator(2) != '' || $field_7xx->indicator(2) == 0) { Would it not be better to use string comparison operators, ne and eq, since indicators may not necessarily be numeric? Please correct me if I am wrong. Bryan Baldus [EMAIL PROTECTED] [EMAIL PROTECTED] http://home.inwave.com/eija -- Corey A Harper Metadata Services Librarian Bobst Library, B42-LL1 New York University 70 Washington Square South New York, NY 10012 212.998.2479 [EMAIL PROTECTED]