Re: problem with subroutines caching values of variables

2001-03-01 Thread Gerald Richter
>>I thought that by being declared inside [- -], the subroutine would be >>recompiled on every request, thus losing any reference to @fields. >> No, the reference is not lost, so what Angus wrote about closures was exactly right. You should simply pass in the @fields as parameter to your sub or

RE: problem with subroutines caching values of variables

2001-03-01 Thread Marcus R. Popetz
p to see for sure... -mp >J>-Original Message- >J>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] >J>Sent: Wednesday, February 28, 2001 10:37 PM >J>To: [EMAIL PROTECTED] >J>Subject: Re: problem with subroutines caching values of variables >J> >J>

RE: problem with subroutines caching values of variables

2001-03-01 Thread Jonny Cavell
IL PROTECTED] J>Subject: Re: problem with subroutines caching values of variables J> J> J>On Wed, Feb 28, 2001 at 06:08:43PM -, Jonny Cavell wrote: J>> [- J>> my @fields = qw(a b); J>> print OUT "@fields"; J>> sub testingit{ J>> prin

Re: problem with subroutines caching values of variables

2001-02-28 Thread Angus Lees
On Wed, Feb 28, 2001 at 06:08:43PM -, Jonny Cavell wrote: > [- > my @fields = qw(a b); > print OUT "@fields"; > sub testingit{ > print OUT "@fields"; > } > -] > > The first print gives the correct value ("a,b") > The second print gives an incorrect answer occasionally - seemingly an old