in reply to Re: Re: returning values
in thread returning values

fglock's reply was addressed to fixing your problem, but he was misguided in telling you that "use strict;" would help you see the problem.

The problem is the lexical scoping of "$weekStr" in the bit that fglock copied into his reply. Note that you use  my $weekStr in two different places, and it appears to be the second "declaration" where you manipulate its value. Whatever value is ultimately assigned in that innermost block will be lost when that block goes out of scope.

Of course, the "strict" pragma is quite content to let you write code like this, even though it may not be in your best interest to do so.

I would suggest that proper indentation would help a fair bit, and I could also put in a plug for a relevant post of mine, which tries to help locate mistaken uses of "my".