473,387 Members | 3,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Printing % value autside the loop

unable to print the % values outside the loop


foreach(@pusharray)
{
$_=~ s/(\s)*$//;

%diskraid_Info = split(/\s*: /, $_);
%diskraid_Info_final = %diskraid_Info;
}

while ((my($k,$v))=each(%diskraid_Info_final)){
print "[$k]<----[$v]\n";
}
Jun 4 '12 #1
1 1610
RonB
589 Expert Mod 512MB
%diskraid_Info_final is being overwritten on each iteration of the foreach loop. So, outside of the loop it will only contain the data from the last iteration of the foreach loop.

You have several options.
1) make %diskraid_Info_final an array of hashes
2) print the data in the foreach loop instead of building a new hash
3) take a couple steps back and in your process and redesign how your compiling your data
Jun 4 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Gustavo Randich | last post by:
The following seems to be a bug. The execution returns rows 1,2. It should return 1,1. In fact, if I run the code within a stored procedure alone (not in a trigger), the loop doesn't overwrite the...
3
by: gasturbtec | last post by:
i'm using access 2000 and have a form in which users can select reports with check boxes and click a print button to print out the selected reports. what i want to do now is place a text box on the...
6
by: david | last post by:
I try to use "for" loop to retrieve and assign values in web form. The code is in the following. But it can not be compiled. What I want to do is: txtQ1.Text =...
4
by: axneer | last post by:
hi frnds. while studying pointers, i came across this example from a book ... here ...at the end z is assigned address of itself by **v, how **z can give value 3.15 if it is addressing itself...
10
by: somenath | last post by:
Hi All, I was trying to understand the pass by value mechanism in c. To understand it I wrote a Small code as mentioned bellow. #include<stdio.h> #include<stdlib.h> #include<string.h> void...
1
by: sksksk | last post by:
I want to achieve the following process in the smarty for $item one i should be able to get the value using loop.index, but without any luck. any help is appreciated. <?php for ($i = 1; $i...
0
it0ny
by: it0ny | last post by:
Hi guys, thanks I am fairly new to this forum so I hope I chose the right place to post this question. I try to make my program printout a deposit's report. I created a class to store the...
11
by: uzairmemon | last post by:
Any one Have coding of Reverse stop watch?
1
by: Donnie Seibel | last post by:
I wrote a script to list all lines in a file with Perl. I am having trouble with the looping part of it. My script is supposed to look at the file and as long as the file is larger than the current...
3
Mary Seelye
by: Mary Seelye | last post by:
public void increaseVolume2() { SoundSample sampleArray = this.getSamples(); SoundSample sample = null; int value = 0; //loop through all the samples in the array for...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.