In the "perverse" category:

use strict; use warnings; my @aap = qw( 0aap 0noot 1mies 2mies 0aap 0noot 1mies 6mies ); for (@aap) { print "$_\n" if - reverse '0' . (/^1(.*)/ .. /^0(.*)/); } __END__ 1mies 2mies 1mies 6mies
I wonder what's more common, the situation described by the OP or the need to know the sequence number of the match? If the former is more common, then I think one could make the case for having the match of the right operand return a string of the form '0En' instead of the current 'nE0'. Then, all that would be required to satisfy the OP's request would be to prepend 0+, or better yet, a minus sign, in front of the .. expression:
if ( -(/^1(.*)/../^0(.*)/) )
whereas if one wanted to keep the line matching the right operand one would omit the 0+ or minus sign:
if ( (/^1(.*)/../^0(.*)/) )
Those who actually wanted the match number, would have to scrape it off the return value:
if ( ( /^1(.*)/../^0(.*)/ ) =~ /(\d+)$/ ) { # $1 contains the sequence number of match
I've tested this scheme a bit, and it seems to work; please let me know if I missed some corner (or not-so-corner) cases.

the lowliest monk


In reply to Re^2: .. operator and not including the condition of right operand by tlm
in thread .. operator and not including the condition of right operand by eXile

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.