Ah, I think we both have different definitions of fields.

Your definition (please correct if I'm wrong) is whatever comes out of the split that is currently implemented in Sort::Fields. In perl terms it would be the output from:

perl -MData::Dumper -e'$_=" a b c"; print Dumper(split /\s+/, $_)' $VAR1 = ''; $VAR2 = 'a'; $VAR3 = 'b'; $VAR4 = 'c';
Using your definition, there are 4 fields here (list indices 0..3)

My definition is what a user of Sort::Fields would naturally count as a field (ignoring initial whitespace), before its musty innards get hold of it. In perl terms, this would be along the lines of:

perl -MData::Dumper -e' $_=" a b c"; print Dumper(split)' $VAR1 = 'a'; $VAR2 = 'b'; $VAR3 = 'c';
Using my definition, there are 3 fields here (list indices 0..2)

I claim that Sort::Fields already will ignore leading whitespace in any field (my definition) except field 1. When there exists leading whitespace in what I call field 1, the currently implemented split in Sort::Fields will return a null for field 1 (your definition).

Is this a good description of the situation?


In reply to Re^8: Bug in Sort::Fields? by cmv
in thread Split(), Initial Spaces, & a limit? by cmv

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.