bazz
08-08-2008, 09:43 PM
Hi,
I have two hashes. One is taken from the session, whereas the other is a validity-checker hash, taken from the db.
chosen options hash: taken from session dump
'options' => {
'Pillows' => 'Goose_Down_Pillow',
'Flowers' => 'Wrapped_Bouquet'
},
valid hash taken from dumper
$VAR1 = 'Pillows';
$VAR2 = {
'Non-Allergenic Pillow' => '0',
'Hollow-Fibre Pillow' => '0',
'Goose Down Pillow' => '0'
};
$VAR3 = 'Flowers';
$VAR4 = {
'Bouquet in a Vase' => '45',
'Arranged Cut Flowers' => '35',
'Wrapped Bouquet' => '55'
};
I need to output :
$options{$key};
$options{$value}
$valid_keys{$third_value} - (the numeric value)
here is my code so far. pointers very very welcome.
bazz
sub show_chosen_options {
my %valid_keys = build_valid_keys();
my %options = % {$session->param('options') };
print Dumper %valid_keys; # outputs ok
while (my($option_category, $option_name) = each(%options)){
while (my ($valid_category, $valid_name, $valid_cost) = each (%valid_keys))
{
print qq( oc =$option_category => on=$option_name => v_c = $valid_cost <br />);
}
}
}
I have two hashes. One is taken from the session, whereas the other is a validity-checker hash, taken from the db.
chosen options hash: taken from session dump
'options' => {
'Pillows' => 'Goose_Down_Pillow',
'Flowers' => 'Wrapped_Bouquet'
},
valid hash taken from dumper
$VAR1 = 'Pillows';
$VAR2 = {
'Non-Allergenic Pillow' => '0',
'Hollow-Fibre Pillow' => '0',
'Goose Down Pillow' => '0'
};
$VAR3 = 'Flowers';
$VAR4 = {
'Bouquet in a Vase' => '45',
'Arranged Cut Flowers' => '35',
'Wrapped Bouquet' => '55'
};
I need to output :
$options{$key};
$options{$value}
$valid_keys{$third_value} - (the numeric value)
here is my code so far. pointers very very welcome.
bazz
sub show_chosen_options {
my %valid_keys = build_valid_keys();
my %options = % {$session->param('options') };
print Dumper %valid_keys; # outputs ok
while (my($option_category, $option_name) = each(%options)){
while (my ($valid_category, $valid_name, $valid_cost) = each (%valid_keys))
{
print qq( oc =$option_category => on=$option_name => v_c = $valid_cost <br />);
}
}
}