I don't know why the subject wouldn't be set, but there are problems with your snippet as shown:
Single quotes will not interpolate. I suggest you split up the line as:
my $cmd = 'mail -s "Test" testmail@server.com, < DailyReport_$d.txt';
print "Running [$cmd]\n";
system($cmd) == 0
or warn "Couldn't run [$cmd]: $! / $?";
That way, you will see that $d does not interpolate in your command line.
You should swap the quoting style and always quote all the components:
my $cmd = "mail -s 'Test' 'testmail\@server.com' < 'DailyReport_$d.txt
+'";
|