Dear Sir,

I'm terribly sorry if my description was not clear. You are right about my statement above, it was not precise, the first one it should be:
If the index difference of two consecutive elements of the array is 1 take the 1st colum of all the array i.e  $sample->[0] .. $sample->[-1] PLUS the 2nd column of the last element of the array   $sample->[-1].
Let me give you the illustration of how I get the result. Basically those enclosed with bar (|) and dash (_) are the one which get selected. Notice also the index difference change.
my $sample1 |str1 |index = 1 |str3 |index = 2 |str5 |index = 3 |str7 |index = 4 | |_______________ |str9 str10 index = 5 |______________________ my $sample2 |str1 str2 | index = 0 |_________ | |str3 str4 | index = 4' |__________| my $sample3 |str1 | index = 3 | |_________ |str3 str4 index = 4 ____________________ my $sample4 = |str1 | index = 1 |str3 | index = 2 |str5 | index = 3 | |______________ |str7 str8 index = 4 ____________________ |str7 str8 | index = 4 |__________| |str9 str10| index = 6 ___________
I hope it's clear to you now

In reply to Re^2: Simple Logic Problem with Perl by Anonymous Monk
in thread Simple Logic Problem with Perl by Anonymous Monk

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.