Hi Joe!
I've been away dealing with other problems..its not that I am ignoring you! For example, the Tax man bites tomorrow and I had to deal with that! Ouch!

More to the Perl point:
The use of the ... and .. pattern matching operators.

I've seen the ... op called the "flip-flop" operator. I don't know what these folks would call the .. operator. They are the same except that ... operates on multiple lines and .. operates on a single line.

Code examples are good so, here we go...!!

#!/usr/bin/perl -w use strict; while (<DATA>) { print if (/^TITLE:/.../^\s*$/); } __DATA__ TITLE: qasfd asfdikyh6rf76 khlyouyih TITLE: oiqywrot6 09809g808 asdfafTITLE: stuff stuff that doesn't matter [asDFKJKLAFG] ASDFKJAFKLJ TITLE: TITLE ASDFASFD not a title paragraph TITLE: 98797 ABCD EFG __END__ ##### prints: ####### TITLE: qasfd asfdikyh6rf76 khlyouyih TITLE: oiqywrot6 09809g808 asdfafTITLE: TITLE: 98797 ABCD EFG
The above prints all lines between and inclusive of the lines that start with TITLE and have a blank line. The .. operator does about the same but is restricted to one line instead of multiple lines.

$1 has to do with first match in the "regex", Regular Expression.

Think of the ... op as kind of a filter. Once you are inside this "filtered" set of lines or tokens, then you can further filter things to further exclude what you don't want. This is like a funnel that takes in gallons and produces "shot glasses" of output.

Having said that, I'm not sure that this is the best way for what you are doing. I am actually not quite sure what your app is. If things haven't worked out, post some more info and we will talk about it.


In reply to Re^5: Text Massage by Marshall
in thread Text Massage by GiJoe

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.