develooper Front page | perl.perl5.porters | Postings from October 2003


Thread Next
Jeff 'japhy' Pinyan
October 29, 2003 08:42
Message ID:
I'm a little confused about the section of perlre which reads:

  The lower-level loops are interrupted (that is, the loop is broken)
  when Perl detects that a repeated expression matched a zero-length sub-
  string.   Thus

    m{ (?: NON_ZERO_LENGTH | ZERO_LENGTH )* }x;

  is made equivalent to

    m{   (?: NON_ZERO_LENGTH )*
         (?: ZERO_LENGTH )?

Is that "|" supposed to be there?  The code

  $n = 0;
  "abc" =~ /(\w|(?{++$n}))*/;

stores 'abc' in $& and 1 in $n.  The code

  $n = 0;
  "abc" =~ /\w*|(?{++$n})?/;

doesn't change $n.

Jeff "japhy" Pinyan
RPI Acacia brother #734
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About