Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
If I write the results of the qx{query} to a file and inspect the contents with vi, each line is the appropriate length (ie, length($field)). Why are $field and trim_length so long? The extra bytes are keeping my compare to $line from finding equality. What can I do to trim the extra bytes from the $field values? Obviously the substr isn't working. Any help greatly appreciated.Line = 'org_name,"My Organization"' Field = 'org_name ' Field Length = 9 Trim Length = 'org_name ' Line ($line) is a string to which I want to compare some key words. Field ($field) is one of the key words. I have placed single quotes ar +ound the value so I can see its length. Field Length ($length) is the result of the Perl length($field) functi +on. Trim Length ($trim_length) is the result of substr ($field, 0, $length +). $field is read from a database table using the @fields = qx{query}; The relationship between @fields and $field comes from a foreach @fiel +d (@fields) loop.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Extraneous Data in Variable
by matija (Priest) on Apr 03, 2004 at 16:42 UTC | |
|
Re: Extraneous Data in Variable
by ambrus (Abbot) on Apr 03, 2004 at 19:38 UTC | |
|
Re: Extraneous Data in Variable
by ysth (Canon) on Apr 04, 2004 at 11:51 UTC | |
by Anonymous Monk on Apr 04, 2004 at 18:47 UTC | |
by ysth (Canon) on Apr 04, 2004 at 19:53 UTC |