> Behalf Of Baker, Lauren
>
> How do I update one field in a hash based on a selection
> of two others?
>
> I have data like this (there are 35 total):
> $flam_table{5} = {ctype => "Capacitor",
> ptype => "Epoxy",
> cc => "15", mass => 0, rating => "UL94V-0"};
> $flam_table{6} = {ctype => "Capacitor",
> ptype => "Metalized Paper",
> cc => "15", mass => 0, rating => "UL94V-0"};
> $flam_table{7} = {ctype => "Inductor",
> ptype => "Thermoplastic",
> cc => "18", mass => 0, rating => "UL94V-0"};
>
> I then have a list of items, where I can figure out the
> "cc" and "ptype" values. I then want to select the correct
> entry and update the mass entry (the list of items has a quantity
> and unit mass - so I multiply and add to the appropriate
> entry). After going thru the list of items, I then spit out
> all these 35 entries into a spreadsheet, one field per
> column.
>
As I understand it you have 'records' with 'fields'. You want to select a
record using one or more fields in the record and then update the record?
You probably should use a database. But if you wish to do it this way...
$flam_table{5} = {ctype => "Capacitor",
ptype => "Epoxy",
cc => "15", mass => 0, rating => "UL94V-0"};
$lookupBy_cc_and_ptype{"15.Epoxy"} = $flam_table{5};
...
#usage
$cc = "15";
$ptype = "Epoxy";
$newMass = "8";
$lookupBy_cc_and_ptype{"$cc.$ptype"}->{"mass"} = $newMass;
# Now $flam_table{5}->{"mass"} is '8'
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users