Help for this page

Select Code to Download


  1. or download this
    #  Rejected possibility one:
    substr( $string, 0, length( $string ) / 2 ) =~ m/pattern/;
    ...
    #  Rejected possibility two:
    my $half = length( $string ) / 2;
    $string =~ m/pattern.{$half}/s;
    
  2. or download this
    use strict;         # Because you should.
    use warnings;       # Because you want to.
    ...
    0000012300
    0000001230
    0000000123
    
  3. or download this
    1230000000 matched.
    0123000000 matched.
    ...
    0000012300 didn't match.
    0000001230 didn't match.
    0000000123 didn't match.
    
  4. or download this
    use strict;
    use warnings;
    ...
    0000012300
    0000001230
    0000000123