Flip-flop, maybe?
perl -le '@full = ( 0..100 ); for ( @full ) { print STDOUT "$_: LIGHTS ON" if /20/ .. /30/; print STDOUT "$_: LIGHTS OFF" if /60/ .. /70/; } ' __output__ 20: LIGHTS ON 21: LIGHTS ON 22: LIGHTS ON 23: LIGHTS ON 24: LIGHTS ON 25: LIGHTS ON 26: LIGHTS ON 27: LIGHTS ON 28: LIGHTS ON 29: LIGHTS ON 30: LIGHTS ON 60: LIGHTS OFF 61: LIGHTS OFF 62: LIGHTS OFF 63: LIGHTS OFF 64: LIGHTS OFF 65: LIGHTS OFF 66: LIGHTS OFF 67: LIGHTS OFF 68: LIGHTS OFF 69: LIGHTS OFF 70: LIGHTS OFF
Though I do not know the proper syntax with variable assignment, so cannot turn the durn lights off! So, it half works....
perl -le '@full = ( 0..20 ); for $ea ( @full ) { print STDOUT "$ea: LIGHTS ON" if $ea =~ /6/ .. /10/; print STDOUT "$ea: LIGHTS OFF" if $ea =~ /15/ .. /20/; } ' __output__ 6: LIGHTS ON 7: LIGHTS ON 8: LIGHTS ON 9: LIGHTS ON 10: LIGHTS ON 11: LIGHTS ON 12: LIGHTS ON 13: LIGHTS ON 14: LIGHTS ON 15: LIGHTS ON 15: LIGHTS OFF 16: LIGHTS ON 16: LIGHTS OFF 17: LIGHTS ON 17: LIGHTS OFF 18: LIGHTS ON 18: LIGHTS OFF 19: LIGHTS ON 19: LIGHTS OFF 20: LIGHTS ON 20: LIGHTS OFF
Hope it helps!

In reply to Re: Match Numeric Range by dbuckhal
in thread Match Numeric Range by PilotinControl

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.