Tar Incremental Backup Perl Script

#!/usr/bin/perl

### Design By Andrew Choi
### Backup Directory

$backupdir = "/etc /u0 /usr/local/mysql /usr/local/apache2/conf /var/spool/cron/crontabs";
$targetdir = "/backup131/files/";
$incremental_recode = $targetdir."data-backup-record";
$tar = "/usr/local/bin/tar";

### Main Program

# Gen Date Code

my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime time;

$year = $year + 1900;
$mon = substr "0".$mon,-2;
$mday = substr "0".$mday,-2;
$hour = substr "0".$hour,-2;
$min = substr "0".$min,-2;
$sec = substr "0".$sec,-2;


$datecode = $year.$mon.$mday.$hour.$min.$sec;

# Run Backup
$command = $tar." zcvf ".$targetdir.$datecode."-incremental-data-backup.tar.gz -g ".$incremental_recode." ".$backupdir;
print $command."\n";

$a = `$command`;