The following should do what you want. Note that the sort is alphabetic instead of numerical - you may want to change to numerical if you know for a fact that all keys will be numbers.
use strict;
use warnings;
my $p;
my %file_attachments = (
'1' => { 'price' => '10.00', 'desc' => 'the 1st test'},
'2' => { 'price' => '12.00', 'desc' => 'the 2nd test'},
'3' => { 'price' => '13.00', 'desc' => 'the 3rd test'},
'4' => {
'' => '',
'35' => 'D',
'11' => '3104052',
'63' => '0',
'167' => 'FUT',
'200' => '200512',
'1' => '2',
'44' => '112.55',
'55' => 'XEURFGBM0F2005Z',
'50' => 'portwaretrader1',
'40' => '2',
'57' => 'RISKGATEWAY',
'15' => 'USD',
'38' => '1',
'52' => '20051118-07:31:46',
'59' => '0',
'60' => '20051118-07:31:40',
'34' => '37',
'56' => 'EXLINK_CAMPBELL',
'49' => 'CAMPBELL_EXLINK',
'10' => '170',
'54' => '1'
}
);
for (sort keys %file_attachments) {
print "'$_' =>\n";
$p = $file_attachments{$_};
print " '$_' => '$p->{$_}'\n" for sort keys %$p;
print "\n";
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.