in reply to Regular expressions

Two problems:

  • Missing space in <!--Start_of_revision-->
  • if rather than while

    A working version of your code in a form that is better for stand alone testing is:

    use strict; use warnings; my $text = join "", <DATA>; while($text =~ /<!-- Start_of_revision-->(.*?)<!-- End_of_revision-->/ +sg) { print $1; } __DATA__ <!-- Start_of_revision--> revision1 <!-- End_of_revision--> <!-- Start_of_revision--> revision2 <!-- End_of_revision--> <!-- Start_of_revision--> revision3 <!-- End_of_revision-->
    revision1 revision2 revision3

    Perl is Huffman encoded by design.