- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Perl: How to reference an array in foreach loop?
Operating System - Linux
1753543
Members
5454
Online
108795
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2005 07:53 PM
12-15-2005 07:53 PM
Perl: How to reference an array in foreach loop?
Hi!
I have a small problem with my CGI-skript.
I have a foreach loop, which should display anything:
foreach $element (@nameList){
print $element;
print XXXXXX;
}
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.
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..
How can I change it, so that this behaviour disappears?
Thank you!
I have a small problem with my CGI-skript.
I have a foreach loop, which should display anything:
foreach $element (@nameList){
print $element;
print XXXXXX;
}
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.
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..
How can I change it, so that this behaviour disappears?
Thank you!
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2005 08:14 PM
12-15-2005 08:14 PM
Re: Perl: How to reference an array in foreach loop?
Error seems to be somewhere else...
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP