in reply to Error message puzzle

An aside: since "" interpolates variables and qq{} is the same (except you don't need to escape quotes in it) you might find this easier to read:
$Query = qq{ EXEC $Stored_procedure $Standardisation, $Disease_cat, $Sex, $Sex_code, $Constraint_ref, $ICD_start_9, $ICD_end_9, $ICD_start_10, $ICD_end_10, $ICD_start_9_B, $ICD_end_9_B, $ICD_start_10_B, $ICD_end_10_B, $ICD_start_9_C, $ICD_end_9_C, $ICD_start_10_C, $ICD_end_10_C, $yearfrom, $yearto, $min_age, $max_age, $region, $Instance_name, $Geo_scope, $number_of_years, $unique_identifier; );
Just makes things a little easier on the eye :)

cLive ;-)