I have a piece of code that I am assured works and I cannot see why it
would.  Code is supposed to force undefined, zero and all space to
numeric zero to stop printf being undefined.

foreach my $value (@array) {
    if( ! $value or $value = "      " ) {
        $value = 0;
    }
}

Will this actually work, or as I suspect do nothing because $value is a
copy.

The root cause of the problem is that the array is read from a file with
a simple substr

  $array[0] = substr( $_, 256, 6 );

Despite documented standards some values are simply filled with blanks.

Then rebuilt with a printf "%06d", $array[0]; and this causes a non
numeric warning.

Is there a 'better' way to do this.

-- 
Ken Foskey
FOSS developer


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


Reply via email to