J
Justin C
Here's how my hash looks:
$hashes{$report}{$line}{$colNumber}
So, in %hashes, is data from several reports, grouped by report, then
line (well, stock code, which is the first field on the line), the
column number. Here is a little of the output of Data:umper:
$VAR1 = 'types';
$VAR2 = {
'BE' => 1
};
$VAR3 = 'stk1324r2';
$VAR4 = {
'BE/COF/DRAGON' => {
'8' => '0',
'6' => '0',
'4' => 'E',
'3' => '1',
'7' => '2',
'9' => '2',
'2' => 'CRADLE OF FILTH dragon WEB BELT',
'5' => '2'
},
'BE/MOT/WARPIG' => {
'8' => '0',
'6' => '0',
'4' => 'E',
'3' => '1',
'7' => '125',
'9' => '125',
'2' => 'MOTORHEAD warpig BADGEBUCKLE BELT',
'5' => '125'
},
I want to output the lines sorted asciibetically based on column 2, in
the above examples that'd be CRADLE OF FILTH..., and MOTORHEAD...
I'd like to provided an example of what I've tried, but the only idea
I've had is to extract the column 2 entries into an array, and then sort
the array and use it in a foreach loop, but then I've got to find a way
of accessing the hash from a value, and not a key (I can't use the
description as my key because there will be some sized items which will
have a different code, but identical description, so the code has to
stay as the key).
Thank you for any help you can give with this.
Justin.
$hashes{$report}{$line}{$colNumber}
So, in %hashes, is data from several reports, grouped by report, then
line (well, stock code, which is the first field on the line), the
column number. Here is a little of the output of Data:umper:
$VAR1 = 'types';
$VAR2 = {
'BE' => 1
};
$VAR3 = 'stk1324r2';
$VAR4 = {
'BE/COF/DRAGON' => {
'8' => '0',
'6' => '0',
'4' => 'E',
'3' => '1',
'7' => '2',
'9' => '2',
'2' => 'CRADLE OF FILTH dragon WEB BELT',
'5' => '2'
},
'BE/MOT/WARPIG' => {
'8' => '0',
'6' => '0',
'4' => 'E',
'3' => '1',
'7' => '125',
'9' => '125',
'2' => 'MOTORHEAD warpig BADGEBUCKLE BELT',
'5' => '125'
},
I want to output the lines sorted asciibetically based on column 2, in
the above examples that'd be CRADLE OF FILTH..., and MOTORHEAD...
I'd like to provided an example of what I've tried, but the only idea
I've had is to extract the column 2 entries into an array, and then sort
the array and use it in a foreach loop, but then I've got to find a way
of accessing the hash from a value, and not a key (I can't use the
description as my key because there will be some sized items which will
have a different code, but identical description, so the code has to
stay as the key).
Thank you for any help you can give with this.
Justin.