The problem is that you're mixing Perl (your timestamp code) and Shell Script (your sample code)...
You can use backticks if you want to execute the shell code:
#!/usr/bin/perl <---- or whatever is your path to perl
use strict;
use warnings;
use DateTime;
my $dt = DateTime->now;
my $date = $dt->ymd;
my $time = $dt->hms;
my $file = "****.com/db_backups/db_backup - $date $time.sql";
print $file;
`mysqldump -h hosturl -u username -p'password' database > $file;`
`gzip -f $file;`
Besides backticks, you can also use system()
or exec