$data = "this is a test" $expression_text = "(.*)es" $data =~ $expression_text $result = $1 which is 'this is a t';