$match #what you want to match $string # the string to extract from if($string =~ /$match(.+)/){ ... do something with $1 ... }