use Mail::Sendmail; my $Date = substr(gmtime $ref_event->{'EventStartDateTime'},0,10); my $SecID = int rand 16777216; my %m; # what I'd like to do except it doesn't work: %m = ( To => $ref_provider->{'ProviderEmail'}, From => 'management@trainingboard.co.uk', Subject => 'COURSE AVAILABILITY INQUIRY', Message => "We have received an inquiry about availability on the following course run by you:\n\n Course Title:\t\t\t $ref_course->{'CourseTitle'}\n \nCourse Date:\t\t\t$Date\n\n Number of Places Requested:\t\t $ref_booking->{'NumberOfAttendees'}\n\n Please confirm within 24 hours whether sufficient places are available (and if not, what alternatives there may be) by visiting the following site: http://www.trainingboard.co.uk/dmp/ $ref_provider->{'ProviderID'}/booking.pl? Action=Confirm Availability&BookingID= $ref->{'BookingID'}&SecID=$SecID", ); # what I am doing at present but hope to improve on: my $To = $ref_provider->{'ProviderEmail'}; my $Message = "We have received an inquiry about availability on the following course run by you:\n\n Course Title:\t\t\t $ref_course->{'CourseTitle'}\n \nCourse Date:\t\t\t$Date\n\n Number of Places Requested:\t\t $ref_booking->{'NumberOfAttendees'}\n\n Please confirm within 24 hours whether sufficient places are available (and if not, what alternatives there may be) by visiting the following site: http://www.trainingboard.co.uk/dmp/ $ref_provider->{'ProviderID'}/booking.pl? Action=Confirm Availability&BookingID= $ref->{'BookingID'}&SecID=$SecID"; %m = ( To => $To, From => 'management@trainingboard.co.uk', Subject => 'COURSE AVAILABILITY INQUIRY', Message => $Message, );