K
Keith
I'm getting myself all confused - nothing new there.
I'm building a data structure something like this (greatly
simplified):
my %company;
..
..
$company{company_code} = {
classes => [ split ('/',
$record->{class_codes}) ]
}
The incoming data field 'class_codes' is structured like this:
"CLASS1/CLASS2/CLASS3/CLASS7/CLASS9"
This means my data structure ends up with an entry called 'classes'
which holds an array reference to a list of class codes. What I'd
really like is that entry to hold a hash reference where each key is a
class code, and the corresponding value is 'Y' (for example).
I did try changing that line to read:
classes => { split ('/',
$record->{class_codes}) => 'Y' }
But that gives me this:
$VAR1 = {
'classes' => {
'CLASS9' => 'Y',
'CLASS3' => 'CLASS7',
'CLASS1' => 'CLASS2'
}
};
I'm missing something fundamental about slices here, I guess. Please
help!
I'm building a data structure something like this (greatly
simplified):
my %company;
..
..
$company{company_code} = {
classes => [ split ('/',
$record->{class_codes}) ]
}
The incoming data field 'class_codes' is structured like this:
"CLASS1/CLASS2/CLASS3/CLASS7/CLASS9"
This means my data structure ends up with an entry called 'classes'
which holds an array reference to a list of class codes. What I'd
really like is that entry to hold a hash reference where each key is a
class code, and the corresponding value is 'Y' (for example).
I did try changing that line to read:
classes => { split ('/',
$record->{class_codes}) => 'Y' }
But that gives me this:
$VAR1 = {
'classes' => {
'CLASS9' => 'Y',
'CLASS3' => 'CLASS7',
'CLASS1' => 'CLASS2'
}
};
I'm missing something fundamental about slices here, I guess. Please
help!