or download this
sub prematch (;$) { substr((@_ ? $_[0] : $_), 0, $-[0]) }
sub match (;$) { substr((@_ ? $_[0] : $_), $-[0], $+[0] - $-[0]) }
sub postmatch (;$) { substr((@_ ? $_[0] : $_), $+[0]) }
...
print "`(",$`,")\n";
print "&(",$&,")\n";
print "'(",$',")\n";