in reply to Re: Attempt at eliminating a global variable
in thread Attempt at eliminating a global variable

Many thanks ikegami.
Much neater too!
  • Comment on Re^2: Attempt at eliminating a global variable

Replies are listed 'Best First'.
Re^3: Attempt at eliminating a global variable
by ikegami (Patriarch) on Jan 18, 2005 at 19:53 UTC

    btw,

    sub scope_test{ my @data_in = <DATA>; my @data_out; for (0..$#data_in){ call_back(\@data_out, $data_in[$_]); } print "$_" for @data_out; }

    can be simplified to

    sub scope_test{ my @data_out; while (<DATA>) { call_back(\@data_out, $_); } print "$_" for @data_out; }

    or even

    sub scope_test{ my @data_out; call_back(\@data_out, $_) while (<DATA>); print "$_" for @data_out; }