On Aug 17, 11:45 am, [EMAIL PROTECTED] (Paul Lalli) wrote: > On Aug 16, 7:21 pm, [EMAIL PROTECTED] (Mr. Shawn H. Corey) wrote: > > > Paul Lalli wrote: > > > So define the subroutine in the same scope as the array. Move the > > > subroutine into the if-statement as well. > > > Huh? > > What part of what I said did you not understand? > > > Please speak Perl. > > Please learn some Perl.
Paul, please take a step back and a deep breath. You are beginning to sound a lot like "she who must not be named". We ask people to reduce their problems to a minimal but complete illustration of the problem they are experiencing. We should not punish them for doing so. In this case you've done so by offering a solution (declaring a named subroutine within a block) what works for the simple illustrative case but would most probably break in the more realistic case where the code is part of a more complex program. And you've not mentioned that this is the case. If the OP's code were to appear inside a loop or subroutine then your suggested approach would only work on the first pass through the code. Fortunately, to let you know this would happen, Perl would generate a 'Variable "@list" will not stay shared' warning. > Google for "closure" if you still don't understand. See the description of the aforementioned warning in perldiag if you still don't understand. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/