Do you really need each component of the timestamp in individual vars? Are they being used elsewhere or are they just being used to build up your tstamp and dstamp strings?
IMO, it would be much cleaner and easier to use the strftime function from the POSIX module.
use POSIX qw(strftime);
my $dstamp = strftime("%Y%m%d", localtime(time));
my $tstamp = strftime("%H%M%S", localtime(time));
print "tstamp is $tstamp\n";
print "dstamp is $dstamp\n";
Which outputs this format:
tstamp is 092141
dstamp is 20140425