Help for this page

Select Code to Download


  1. or download this
    if ( $contents =~ /line3/g ) {
      if ( $contents =~ /(line2-)(\w*)/g ) {
        print $2;
      }
    }
    
  2. or download this
    if ( $contents =~ /^line3/mo ) {
      if ( $contents =~ /^line2-(\w*)/mo ) {
        print $1; # has to be changed as well
      }
    }
    
  3. or download this
    my $string = "abcde abcde adcde";
    while ($string =~ /cd/og) {
    ...
          print "a$1 matched at ",pos $string, "\n";
        }
    }