<?xml version="1.0" encoding="windows-1252"?>
<node id="268427" title="Re: Re: Re: Optimizing the bejeezus out of a sub" created="2003-06-24 04:55:47" updated="2004-08-22 12:29:17">
<type id="11">
note</type>
<author id="127307">
IlyaM</author>
<data>
<field name="doctext">
&lt;code&gt;foreach my $section ( @_ ) { ... }&lt;/code&gt; 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:
&lt;p&gt;
&lt;code&gt;
# adds 1 to all elements of array
foreach my $elem (@arr) {
    $elem ++;
}
&lt;/code&gt;

&lt;p&gt;
&lt;font color="grey" size="-2"&gt;
--&lt;br&gt;
Ilya Martynov,  &lt;a href="mailto:ilya@iponweb.net"&gt;ilya@iponweb.net&lt;/a&gt;&lt;br&gt;
CTO IPonWEB (UK) Ltd&lt;br&gt;
Quality Perl Programming and Unix Support
UK managed @ offshore prices - &lt;a href="http://www.iponweb.net"&gt;http://www.iponweb.net&lt;/a&gt;&lt;br&gt;
Personal website - &lt;a href="http://martynov.org/"&gt;http://martynov.org&lt;/a&gt;&lt;br&gt;
&lt;/font&gt;</field>
<field name="root_node">
268405</field>
<field name="parent_node">
268414</field>
</data>
</node>
