http://qs321.pair.com?node_id=268427


in reply to Re: Re: Optimizing the bejeezus out of a sub
in thread Optimizing the bejeezus out of a sub

foreach my $section ( @_ ) { ... } doesn't copy value from @_ to $section. In the loop the variable $section is merely an alias to a currently selected element in @_ array. You can even modify @_ array by assigning a new value to $section. Example:

# adds 1 to all elements of array foreach my $elem (@arr) { $elem ++; }

--
Ilya Martynov, ilya@iponweb.net
CTO IPonWEB (UK) Ltd
Quality Perl Programming and Unix Support UK managed @ offshore prices - http://www.iponweb.net
Personal website - http://martynov.org