in reply to Re^2: retrieve data from array empty
in thread retrieve data from array empty

Let me explain the "may have $lastmonth set to nonsense values" issue:

my $lastmonth=$mon-1;

I assume that $mon represents a month. It must be numeric (unless overloaded). That usually means either 1..12 for January to December (as on any calendar) or 0..11 (as returned by localtime and gmtime). What happens when $mon represents January and you subtract 1? In the first case, you get 0, which is nonsense. In the second case, you get -1, which is exactly the same nonsense.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)