Hi All,
I need to read in some data and put it into a data structure ex:
knife #product name
3 #quantity
1 #price
I would like to hold in as a hash referancing other hashes ex:
$ref=read_data();
sub read_data{
open $RD,"< value.dat" || print "could not process request\n";
while( chomp ( $product = <$RD> ) ){
chomp ( $quantity = <$RD> );
chomp ( $price = <$RD> );
$inventory{$product}={
quantity=> $quantityr,
price => $price
};
}
return \%inventory;
}
now how can I access the elements for example:
foreach( sort keys %{ $ptr } ){
print the quantity and price of each product
if a given product exist print its price
}
Thanx in Advance,
Mark Goland