<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1011798" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1011798</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/foreach-loop#comment-1067707</link>
    <description> &lt;p&gt;foreach gives you a copy of each element in the array.&lt;/p&gt;
&lt;p&gt;your &quot;nifty&quot; regex/substitution replaces the &quot;$variable&quot; in $item (which only consists of $variable) with nothing.&lt;br /&gt;
So why not just write $item=&quot;&quot;; ?&lt;/p&gt;
&lt;p&gt;You can put all items of the array that you want to keep into a new array.&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;my @array2 = ( );&lt;br /&gt;foreach $item( @array ){&lt;br /&gt;&amp;nbsp; if( $item ne $variable ){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; push( @array2, ( $item ) );&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;}&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;As usually untested, since I don&#039;t have perl on this box&lt;/p&gt;
&lt;p&gt;ciao&lt;br /&gt;
Anti&lt;/p&gt;
 </description>
     <pubDate>Tue, 18 Jul 2000 10:24:14 +0000</pubDate>
 <dc:creator>anti</dc:creator>
 <guid isPermaLink="false">comment 1067707 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
