Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    ...
    __OUTPUT__
    $s =~ s/(?-xism:(foo)(bar))/$1-$2/ at -e line 1.
    foo-bar
    
  2. or download this
    perl -le '$s = foobar; $search=qr/(foo)(bar)/; $replace="\$1-\$2"; $s 
    +=~ s/$search/eval $replace/e; print $s'