You posted a set of "data" that has three lines, and it's hard to know how to interpret that. (How many fields are there, really? Why is it that the groups of hyphens on the second line do not match the widths of fields on the other lines?)
Meanwhile, the script is reading the output from some other process. (Is the data sample the exact output of that process? If not, it would be better to show us that output.)
If the problem is that the first line of output from the other process (the column headings?) has more fields than any of the other lines, why even worry about it? Just skip that line:
open( SANCLI, "datapath query essmap |" ) or die "unable to open pipe.
+.. $!";
$_ = <SANCLI>; # read first line, do nothing with it
while(<SANCLI>) {
...
If you actually need to keep the column headings (e.g. to use them as hash keys later), just remove the "P" column from that one line before splitting it:
open( SANCLI, "datapath query essmap |" ) or die "unable to open pipe.
+.. $!";
$_ = <SANCLI>;
s/\s+P\s+/ /;
my @col_headings = split;
while(<SANCLI>) {
my %fields;
@fields{@col_headings} = split;
...
}
If I'm not answering your question, please try to be more clear about what the problem is.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.