$s = "Freddy";

if ($s =~ /(.*)(ed)(.*)/) { # just make 3 sets of ()s
  print "Before: $1\nMatch: $2\nAfter: $3";
}
else {
  print "Your string didn't match!";
}


































