[Pdx-pm] file processing - from to delimiters

Tkil tkil at scrye.com
Sun May 16 00:49:47 CDT 2004

>>>>> "MR" == Michael Rasmussen <mikeraz at patch.com> writes:

MR> I have this memory that there's some perl construct of the form

MR> KEYWORD ( RE1 .. RE2 ) {
MR> 	code;
MR> }

MR> where (for instance) reading a file the code will only be executed
MR> after RE1 has been encountered and before RE2 has been
MR> encountered.  for instance

MR> KEYWORD ( /<head>/i .. /<\/head>/i ) {
MR> 	process headers for web page;
MR> }

MR> Am I remembering a dream or is this a feature of the language?  If
MR> it is a feature, what is the keyword?

MR> It's not something I'm finding in `man perlsyn` or `man perlfunc`

It's the range operator ".." (thus in perlop) and it simply evaluates
to true or false.  so:

  while (<>)
      if ( /start/ .. /end/ )
          print "in range\n";

There is also "...", which is very closely related.  There are some
special cases to both of them.


More information about the Pdx-pm-list mailing list