in reply to Re: Can a large subroutine be split in two (e.g. parent and child relationship)
in thread Can a large subroutine be split in two (e.g. parent and child relationship)?

That creates a closure on the variables which is different behaviour than having the variables local to $foo. Consider:

use strict; use warnings; { my ($var1, $var2, $var3, @arr1); sub foo { bar(); } sub bar { ++$var1; print "$var1\n"; } } foo (); foo ();

Prints:

1 2

DWIM is Perl's answer to Gödel

Replies are listed 'Best First'.
Re^3: Can a large subroutine be split in two (e.g. parent and child relationship)
by Hue-Bond (Priest) on Jul 05, 2006 at 21:08 UTC
    That creates a closure on the variables

    It was intended but now I realize that I didn't take into account the outcome you are showing.

    --
    David Serrano