I just read FAQ on finding out yesterday's time.
I see that one of the easy way to find out is
my $date = scalar localtime( ( time() - ( 24 * 60 * 60 ) ) );
print "$date\n";
and it works fine for me
I also see lot of modules that will make life easier for beginners.. but
since I was learning reference, I wanted to try this on my own
since Leap year is not a huge factor, so
my @[EMAIL PROTECTED]
= (1..31);
my @[EMAIL PROTECTED]
= (1..29);
my @[EMAIL PROTECTED]
= (1..31);
my @[EMAIL PROTECTED]
= (1..30);
my @[EMAIL PROTECTED]
= (1..31);
my @[EMAIL PROTECTED]
= (1..30);
my @[EMAIL PROTECTED]
= (1..31);
my @[EMAIL PROTECTED]
= (1..31);
my @[EMAIL PROTECTED]
= (1..30);
my @[EMAIL PROTECTED]
= (1..31);
my @[EMAIL PROTECTED]
= (1..30);
my @[EMAIL PROTECTED]
= (1..31);
my @[EMAIL PROTECTED]
= [ @[EMAIL PROTECTED]
my $i ( 0 .. $#cal_r ) {
for my $j ( 0 .. $#{ $cal_r[ $i ] } ) {
print "$cal_r[ $i ][ $j ]\n";
}
}
and then just check to see if it's first day of the month and if it is,
go through @[EMAIL PROTECTED]
and find the previous month and find the last array
item..
Algorithm seems to be correct but I cannot get to the item the way I
thought I could.
What would be the correct syntax if I knew the date? say Apr 1st to find
the yesterday's date given above?
I was thinking something along the line of
for my $i ( 0 .. $#cal_r ) {
if ($cal_r[$i][0]) {
print "yesterday is $cal_r[$i-1][lastday]\n"
}
}