Nyimi Jose wrote: > > > From: Jenda Krynicky [mailto:[EMAIL PROTECTED]] > > > > From: christopher j bottaro <[EMAIL PROTECTED]> > > > > > > #populate @array > > > return [ @array ]; > > > } > > > } > > > > Well ... I would use > > > > return \@array; > > > > it's a bit more Perlish and actually I expect it to be > > quicker. (Benchmarking is left to the reader) > > use Benchmark; > > sub using_aref{ > my $aref=[]; > > @$aref=(1,2,3,4,5); > return $aref; > } > > sub using_array{ > my @array=(); > > @array=(1,2,3,4,5); > return \@array; > }
Christopher was asking about "return [ @array ]" which returns a reference to a _copy_ of the array (very slow) and Jenda correctly pointed out that "return \@array" is faster because there is no copying involved however your benchmark doesn't compare these two methods. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]