Error happened when running perl script on Ubuntu machine after coping it from another.
Issue must have been caused by different encodings and was resolved by removing newline in the middle of the command.
# Monthly Backup system("$MYSQLDUMP --user=$DB_USER --password='$DB_PASS' $db_name > $BACKUP_DIR/$db/${db}_monthly_$datestamp.sql");
Changed to
# Monthly Backup system("$MYSQLDUMP --user=$DB_USER --password='$DB_PASS' $db_name > $BACKUP_DIR/$db/${db}_weekly_$datestamp.sql");