wfsp has asked for the wisdom of the Perl Monks concerning the following question:
This seems to be very expensive.
#! perl use warnings; use strict; scope_test(); sub scope_test{ my @data_in = <DATA>; my @data_out; for (0..$#data_in){ @data_out = call_back($data_in[$_], @data_out); } print "$_" for @data_out; } sub call_back{ my $element = shift; my @data_out = @_; push @data_out, $element; return @data_out; } __DATA__ line one line two line three
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Attempt at eliminating a global variable
by ikegami (Patriarch) on Jan 18, 2005 at 18:56 UTC | |
by wfsp (Abbot) on Jan 18, 2005 at 19:09 UTC | |
by ikegami (Patriarch) on Jan 18, 2005 at 19:53 UTC |