$match = "chiapet"; # default value if ($string =~ /foobar(...)/) { # probably want to capture something here $match = $1; }