Hi,
I have a hash in hash file in perl which looks some thing like this: - $FIELDS = {
-
'abc' => {
-
'Description' => {
-
'Purpose' => 'some data is present',
-
'Background' => 'something',
-
}
-
'Run Instructions' => {
-
'Data' => 'something',
-
'DEFAULT.INITIAL_WIPE' => 'somethng',
-
'DEFAULT.SC_ON' => 'somethng',
-
}
-
'File' => '1',
-
'Category => 'somethng',
-
},
-
'xyz' => {
-
'Description' => {
-
'Purpose' => 'some data is present',
-
'Background' => 'something',
-
}
-
'Run Instructions' => {
-
'Data' => 'something',
-
'DEFAULT.INITIAL_WIPE' => 'somethng',
-
'DEFAULT.SC_ON' => 'somethng',
-
}
-
'File' => '2',
-
'Category => 'somethng',
-
},
-
............so on and so forth
-
};
I want to display the values present in the inner hash i.e 'Description' and 'Run Instructions'.
I start off with somethng like this: - %mydata = $FIELDS;
-
foreach my $key (sort {$myData{$a}{Category} cmp $myData{$b}{Category} or
-
$myData{$a}{File} cmp $myData{$b}{File}} keys %myData) {
-
.....................
-
..................
-
if ($myData{$key}{'Description'}){
-
print "<br><b>Description:</b><br>";
-
my $counterdesc = $myData{$key}{'Description'};
-
%desc = %$counterdesc;
-
while (($keydatadesc,$valuedatadesc) = each(%desc)) {
-
if ($keydatadesc =~ /^Data$/) {
-
print $valuedatadesc."<br>";
-
}
-
}
-
foreach my $keydesc (keys %desc) {
-
if ($keydesc !~ /^Data$/) {
-
print "<font
-
color=blue><b>$keydesc:</b></font><br>";
-
if ($desc{$keydesc} !~ /^$/) {
-
print $desc{$keydesc}."<br>";
-
}
-
else {
-
print $desc{$keydesc}."<br><br>";
-
}
-
}
-
}
-
}
-
......Somethng for Run Instruction also
-
.....
-
}
The problem is that while I run the loop to display the items present in 'Description' I dont get the keys in the order they are present in the hash file i.e if for the hash 'abc' ,I want 'Purpose' first followed by 'Background'... But while sorting the order gets shuffled...and I end up getting the information but the keys are shuffled..I also dont want to sort it as that does not fulfill my requirement.
I want the keys present in the inner hash exactly in the same order as it is present in the file..
Please reply as soon as possible...
5 2587 KevinADC 4,059
Recognized Expert Specialist
There is no urgent help here so in the future don't ask for it.
If you want to maintain order, use an array to store the hash keys you want to display in a certain order.
Hi Kevin,
I tried doin it in the array...But stil the problem did not resolve..I figured out tht there is some problem while I dereference the hash 'Description'.M working on that..
Thanks..
KevinADC 4,059
Recognized Expert Specialist
When you want help with your code, post it.
Hey kevin,
Thanks for the reply.Next time I shall post the code...
I got the solution for the problem...
Thnks again for the help!!!!
KevinADC 4,059
Recognized Expert Specialist
Hey kevin,
Thanks for the reply.Next time I shall post the code...
I got the solution for the problem...
Thnks again for the help!!!!
Well, considering I was no help to you that I can see, you're very welcome.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: |
last post by:
The data file is a simple Unicode file with lines of text. BCP
apparently doesn't guarantee this ordering, and neither does the
import tool. I want to be able to load the data either sequentially or
add line numbering to large Unicode file (1 million lines). I don't
want to deal with another programming language if possible and I
wonder if there's a trick in SQL Server to get this accomplished.
Thanks for any help.
Mark Leary
|
by: tilak.negi |
last post by:
We have one single hash (#) table, in which we insert data processing
priority wise (after calculating priority).
for. e.g.
Company Product Priority Prod. Qty Prod_Plan_Date
C1 P1 1 100
C1 P2 2 50
C1 P3 3 30
C2 P1 1 200
C2 P4 2 40
|
by: Sebastian Dau |
last post by:
Hello,
I'm writing a security related application in .NET 1.1
and I wonder how I compute hashes from very large files (up to 1 GB).
Does anybody know a good pattern of how to create a stream from a binary
file
and compute the hash of it?
|
by: spohle |
last post by:
hi i have a normal dictionary with key and value pairs. now i wanna
sort by the keys BUT in a specific order i determine in a list !? any
ideas
dic = {'key1':'value1', 'key2':'value2', 'key3':'value3'}
list =
|
by: kdotsky |
last post by:
Hello,
I am using some very large dictionaries with keys that are long strings
(urls). For a large dictionary these keys start to take up a
significant amount of memory. I do not need access to these keys -- I
only need to be able to retrieve the value associated with a certain
key, so I do not want to have the keys stored in memory. Could I just
hash() the url strings first and use the resulting integer as the key?
I think what I'm...
| |
by: blackice |
last post by:
Hello All,
i have a Perl Script that deleting Zones from named.conf file and here is the script
#!/usr/bin/perl -w
use strict;
print "please enter the domain name: ";
chomp (my $targetdomain = <STDIN>);
|
by: Emily Wang |
last post by:
I have a code package, whick can be compiled, run correctly on linux,
but I have to transplant it to windows vc 2005
Some problems arrise, it is not compatible...
I need a compatible hash file which can run in vc2005
Who can help me to solve the problem ??
Please!!
PS:my work is cannt continue..... I'm a newer...
|
by: Protim |
last post by:
How can I read a hash file using C#
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |