At the risk of being over simplistic, can you just add a number_ to the
front of your hash key?
my $rhHash =
{
'4_B' => "Fourth element",
'2_A' => "Second element",
'1_D' => "First element",
'3_F' => "Third element",
};
print "$rhHash->{$_}\n" foreach sort(keys %{ $rhHash });
At 15:01 21.06.2001 -0400, Yacketta, Ronald wrote:
>Folks,
>
>I have a the following hash that _MUST_ be outputed in a specified order
>every time.
>
>hash:
>
>my %lookFor = (
> "ORA-" => "ORACLE errors (various
>Oracle errors)",
> "Fault 2-001" => "Host/server down or
>unresponsive",
> "Fault 2-002" => "no orbix daemon or
>unresponsive",
> "Fault 2-003" => "Can not bind to
>Authorization Object (ACF2/Message Broker)",
> "Fault 2-004" => "Can not bind to Contract
>Object (CMS/Get Q/Message Broker)",
> "Fault 2-005" => "Can not bind to Order
>Object (Order Submit/Message Broker)",
> "Fault 2-006" => "Authorization Object
>fault (ACF2/Message Broker)",
> "Fault 2-007" => "Contract Object fault
>(CMS/Get Q/Message Broker)",
> "Fault 2-008" => "Order Object fault (Order
>Submit/Message Broker)",
> "Fault 2-009" => "CHI 3270 session fault
>(Customer Information/TRG)",
> "Fault 2-010" => "CAPS 3270 session fault
>(Trade-in Information/TRG)",
> "Fault 2-011" => "Sale Range 3270 session
>fault (Negotiated Credit Info/TRG)",
> "Fault 2-012" => "Oracle DBMS offline",
> "Fault 2-013" => "Oracle DBMS is out of
>critical resource",
> "Fault 2-015" => "Factory Server failed to
>start Session Server",
> "Fault 2-016" => "CAPS Broker failure
>(Serial, Order Information/TRG)",
> "Fault 2-017" => "CAPS Broker fault
>(Serial, Order Information/TRG)",
> "Fault 2-018" => "Pooling Broker failure
>(Pooling Information/TRG)",
> "Fault 2-019" => "Pooling Broker fault
>(Pooling Information/TRG)",
> "\\w+Bin\\w+Factory" => "Bind to Factory failure",
> "SystemError" => "SystemError",
> "SystemException" => "SystemException",
> "\\w+Communication\\w+failure" => "Communication failure",
> "\\w+ORBA" => "ORB problem",
> "Get Q Error" => "(Message Broker).",
> "Test App Finished" => "Number of clients
>Finished"
>);
>
>
>the order
>
>print SFN "Date/Time Stamp,ORA-00001: unique constraint violation,";
>print SFN"Fault 2-001,Fault 2-002,Fault 2-003,Fault 2-004,Fault 2-005,";
>print SFN "Fault 2-006,Fault 2-007,Fault 2-008,Fault 2-009,Fault 2-010,";
>print SFN "Fault 2-011,Fault 2-012,Fault 2-013,Fault 2-015,";
>print SFN "Bind to Factory Failure,SystemException,Communication failure,";
>print SFN "ORB problem,Get Q Error,# of clients still running,";
>print SFN "# of PricingSessions still running,# of clients Finished Test,";
>print SFN "smtx / syscl,user %,sys %,wt %,idl %,current load average\n";
>
>seeing that this is a hash, there is absolutely no guarantee that the output
>will be
>correct when it is printed. I could sort the hash, but the order is still
>wrong.
>
>any suggestions?
>
>Regards,
>Ron
>
>P.S
>don't be to critical of the print's above, yes there are a few extra
>elements in it.
>Those are generated outside the hash and can be plopped into the output
>where need be. I am
>mainly concerned with the proper output of the hash in the order
>specified....
Aaron Craig
Programming
iSoftitler.com