Dear Monks:
In a program that parses a text file by opening and splitting a simple two-column file into array elements, I find that about 50% of the 3700 or so entries print out with the first element visually truncated. I don't mean that the value has changed, just that anything I try to print out in that first position is missing the first 2 characters on about half of the lines as they are displayed. If I 'pad' the line with 2 spaces on the print line, visibility is restored. I can print out the values separately in the program without difficulty. This seems to affect any array values or other variables (or literals) I try to print.
This has me stumped. I've searched Google on strings like "perl print not visible" or "perl print truncates" to no avail. Keep in mind that about half of the entries print with no drama at all. I have scrubbed the source data for unprintable characters, etc. Anything--and I mean anything (even the word RECORD) is truncated on the output of the program for those certain records.
Here's a sample of the code with some redactions:
while (defined(my $line = <FH>)) { chomp $line; my @hostpair = split(' ',$line); my $host = $hostpair[0]; my @FQDN = split(/ /,`host $host`,2); my $OWNER; if (exists $MYDB{uc($host)}) { $OWNER = $MYDB{uc($host)} } else { $OWNER = "OTHER"; } print "$host \t $FQDN[0]\t $hostpair[1] \t $OWNER \n"; }
The source data is a simple two-column space-delimited file showing short hostname in column 1 and a three-letter identifier in column 2
Your help is much appreciated!
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |