I must process the output of an SQL query using Perl. I know the column position of the data in the output file, which means that I am able to calculate the width of each field.
All of the data in the file is left-aligned to the field, except for one column. Basically, in the output of the SQ query, the right-aligned colum looks like this: NODE_UL ============= 146 281 985 So both the data and Field Title are right-aligned to the column. I am using a function cal of the form: $field_value=substr( $input_line , $field_start, $field_width ) ; Where: $input_line : line read from the source data file $field_start : fixed value read from a table (array) $field_width : calculated value of the field width, from the field boundary definitions in the table $field_value: value retruned by the function However, for some strange reason, the Perl substr() function is unable to read the right-most character of a right-aligned field. So in the output data the above numbers would be 14, 28, 98. I have extended the boundary column number in the field definition table, so that substr() uses a bigger field width. But this has not solved the problem. Extending the field boundary to the right has no effect, even if I use a ridiculous value. Does this sound like some sort of bug?? The substr() function has no problem processing left-aligned fields and I have have said, increasing the field width does not solve the problem either. I am using Perl 5.8.4 on Solaris. I know I could probably fix this by tweaking the SQL query but it would still be nice to know what exactly is going on here. Thanks in advance for any help you can give. Regards, Bill Harpley