<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Perl: How to reference an array in foreach loop? in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/perl-how-to-reference-an-array-in-foreach-loop/m-p/4947273#M103095</link>
    <description>Hi!&lt;BR /&gt;&lt;BR /&gt;I have a small problem with my CGI-skript.&lt;BR /&gt;I have a foreach loop, which should display anything:&lt;BR /&gt;&lt;BR /&gt;foreach $element (@nameList){&lt;BR /&gt;  print $element;&lt;BR /&gt;  print XXXXXX;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;The problem is exactly where XXXX is: There should be an array, which name is the name contained in $element, for example $element=cpu, then array's name is @cpu.&lt;BR /&gt;&lt;BR /&gt;If I put @$element on that place, I get always the previous output again, for example in the first loop I have @cpu, in the 2 loop I have @tty, and instead getting only the @tty contents, I'm getting again the cpu-contents and after this the tty-content. The same picture with three elements: I get 3 ouputs, instead of one...and so on..&lt;BR /&gt;How can I change it, so that this behaviour disappears?&lt;BR /&gt;&lt;BR /&gt;Thank you!</description>
    <pubDate>Fri, 16 Dec 2005 03:53:53 GMT</pubDate>
    <dc:creator>Kalin Evtimov</dc:creator>
    <dc:date>2005-12-16T03:53:53Z</dc:date>
    <item>
      <title>Perl: How to reference an array in foreach loop?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-how-to-reference-an-array-in-foreach-loop/m-p/4947273#M103095</link>
      <description>Hi!&lt;BR /&gt;&lt;BR /&gt;I have a small problem with my CGI-skript.&lt;BR /&gt;I have a foreach loop, which should display anything:&lt;BR /&gt;&lt;BR /&gt;foreach $element (@nameList){&lt;BR /&gt;  print $element;&lt;BR /&gt;  print XXXXXX;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;The problem is exactly where XXXX is: There should be an array, which name is the name contained in $element, for example $element=cpu, then array's name is @cpu.&lt;BR /&gt;&lt;BR /&gt;If I put @$element on that place, I get always the previous output again, for example in the first loop I have @cpu, in the 2 loop I have @tty, and instead getting only the @tty contents, I'm getting again the cpu-contents and after this the tty-content. The same picture with three elements: I get 3 ouputs, instead of one...and so on..&lt;BR /&gt;How can I change it, so that this behaviour disappears?&lt;BR /&gt;&lt;BR /&gt;Thank you!</description>
      <pubDate>Fri, 16 Dec 2005 03:53:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-how-to-reference-an-array-in-foreach-loop/m-p/4947273#M103095</guid>
      <dc:creator>Kalin Evtimov</dc:creator>
      <dc:date>2005-12-16T03:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: Perl: How to reference an array in foreach loop?</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-how-to-reference-an-array-in-foreach-loop/m-p/4947274#M103096</link>
      <description>Error seems to be somewhere else...</description>
      <pubDate>Fri, 16 Dec 2005 04:14:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-how-to-reference-an-array-in-foreach-loop/m-p/4947274#M103096</guid>
      <dc:creator>Kalin Evtimov</dc:creator>
      <dc:date>2005-12-16T04:14:57Z</dc:date>
    </item>
  </channel>
</rss>

