Hi,
The module "Tie::Hash" might be one of the solutions that you are looking for.
Regards,
G. Indragoby.
--- On Wed, 19/11/08, Fish, David <[EMAIL PROTECTED]> wrote:
From: Fish, David <[EMAIL PROTECTED]>
Subject: Reading hash arrays in the order it was written
To: activeperl@listserv.activestate.com, [EMAIL PROTECTED], [EMAIL PROTECTED]
Date: Wednesday, 19 November, 2008, 9:27 PM
Hello! The problem I am having is I am pulling data from a table in a
certain order and loading it into the hash array but when I read the
hash array it comes out in a different order than it is written. What I
have done as a work around, is the read the data from a file that has it
in the correct order. Is there away to build the hash so that it reads
in the order it was created?
Key creation and hash build:
select statement ordering by certain columns
......
$key = sprintf("%04d%07d%07d",$chk_num,$trans_seq,$dtl_seq);
$midtlinfo{$key} =
sprintf("%d|%d|%s|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%s|%s|%d|%d|%0.2f|%0.
2f|%0.2f",
$se_chk_mi_seq,
$obj_num,
$business_date,
$chk_num,
$trans_seq,
........
);
Reading of the hash:
foreach $mk (keys %midtlinfo)
@mrec = split(/\|/,$midtlinfo{$mk});
....
}
David Fish
Senior Systems Analyst
Property Systems Services
Work (301) 380-3331
Fax (301) 644-7521
BlackBerry (301) 646-8985
[EMAIL PROTECTED]
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Be the first one to try the new Messenger 9 Beta! Go to
http://in.messenger.yahoo.com/win/
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs