use constant WEEK => 60 * 60 * 24 * 7; my $expiry_date = sprintf '%04d-%02d-%02d', sub { $_[5]+1900, $_[4]+1, $_[3] }->(localtime(time + 2 * WEEK)); #### print MAIL <<"END_OF_MAIL"; To: bar\@foo.com Reply-to: $email From: $email Subject: AP3k New User Signup Test Mail1 END_OF_MAIL