Help for this page

Select Code to Download


  1. or download this
    sub prematch {
        return unpack "a$-[0]", $_[0];
    ...
        my $len = $+[0] - $-[0];
        unpack "x$-[0] a$len", $_[0];
    }
    
  2. or download this
    use strict;
    use warnings;
    ...
        print postmatch($string), "\n";
        print match($string), "\n";
    }
    
  3. or download this
    my ($pre, $match, $post) = split /\b(word)\b/, $string, 2;