in reply to Array of variables

Always, at the top of your Perl code:

use warnings; use strict;

Now:

@Variable[$X]=$Year."-".$Months{$Month} ."-" . $Day ;

You have not declared the @Variable array. You have @Variables. Also, when assigning to an array *element*, use scalar context:

$Variables[$X] = ...;