Help w/ Perl dates

I need to create 12 variables, the first of which is the date of the first day of the current month (01/01/2006), and the remaining 11 are to equal each month after the current.

var1 = 01/01/2006
var2 = 02/01/2006
var3 = 03/01/2006
var4 = 04/01/2006
etc.

How can I easily do this is in Perl?

$ more test1.pl
#!/sbcimp/run/pd/perl/5.6.1/bin/perl

my ($date1,$date2,$date3,$date4,$date5,$date6,$date7,$date8,$date9,$date10,$date11,$date12);

my ($day,$mnth,$year) = (localtime (time)) [ 3,4,5 ];

$year+=1900;
$mnth+=1;

for( my $i=1; $i <= 12; $i++ ) {
my $str=sprintf("\$date$i=\"%02d/01/$year\"",$mnth);
eval $str;
$mnth++;
if ( $mnth > 12 ) { $mnth=1; $year++; }
}

for( my $i=1; $i <= 12; $i++ ) {
my $str=sprintf("print \"\$date$i\\n\"");
eval $str;
}

$ test1.pl
01/01/2006
02/01/2006
03/01/2006
04/01/2006
05/01/2006
06/01/2006
07/01/2006
08/01/2006
09/01/2006
10/01/2006
11/01/2006
12/01/2006

Thank you. Now how do I assign the returned values to each of the variable names?

Values were already assigned to the date variables from $date1...$date12

The below part actually printing the variable values ...

for( my $i=1; $i <= 12; $i++ ) {
my $str=sprintf("print \"\$date$i\\n\"");
eval $str;
}

Instead, you can remove the above stuff...
and add the below...

print "$date1\n";
print "$date2\n";
print "$date3\n";
print "$date4\n";
print "$date5\n";
print "$date6\n";

you can add print statement upto $date12

This script worked the other day when I ran it, but now it prints this:

01/01/1900
02/01/1900
03/01/1900
04/01/1900
05/01/1900
06/01/1900
07/01/1900
08/01/1900
09/01/1900
10/01/1900
11/01/1900
12/01/1900

What happened to the 2006? Here's my code:

my ($date1,$date2,$date3,$date4,$date5,$date6,$date7,$date8,$date9,$date10,$date11,$date12);

my ($day,$mnth,$year) = (localtime (time)) [ 3,4,5 ];

$year+=1900;
$mnth+=1;

for( my $i=1; $i <= 12; $i++ ) {
my $str=sprintf("\$date$i=\"%02d/01/$year\"",$mnth);
eval $str;
$mnth++;
if ( $mnth > 12 ) { $mnth=1; $year++; }
}

for( my $i=1; $i <= 12; $i++ ) {
my $str=sprintf("print \"\$date$i\\n\"");
eval $str;
}

I'm not finding any problem...

$ more t.pl
my ($date1,$date2,$date3,$date4,$date5,$date6,$date7,$date8,$date9,$date10,$date11,$date12);

my ($day,$mnth,$year) = (localtime (time)) [ 3,4,5 ];

$year+=1900;
$mnth+=1;

for( my $i=1; $i <= 12; $i++ ) {
my $str=sprintf("\$date$i=\"%02d/01/$year\"",$mnth);
eval $str;
$mnth++;
if ( $mnth > 12 ) { $mnth=1; $year++; }
}

for( my $i=1; $i <= 12; $i++ ) {
my $str=sprintf("print \"\$date$i\\n\"");
eval $str;
}

$ perl t.pl
01/01/2006
02/01/2006
03/01/2006
04/01/2006
05/01/2006
06/01/2006
07/01/2006
08/01/2006
09/01/2006
10/01/2006
11/01/2006
12/01/2006

could you please try to print the $year value before the for loop and see what it prints ?

Sorry about that. I had use Time::localtime; in my code. Thanks

How can I load these values into an array called @month_start?