Building a Price List : Hash Value « Hash « Perl






Building a Price List

    


#!/usr/local/bin/perl
%inventory = (A=>45_000.00,b=>120.00,C=>450_000.00,d=>40.00);

open (INV, ">price.list");
foreach $item (sort keys %inventory){
   print INV join(":", ($item, $inventory{"$item"})), "\n";
}
close INV;

   
    
    
    
  








Related examples in the same category

1.Associative arrays are indexed by string values.
2.Using array as the hash value
3.Using the array as the hash value
4.Hash setting and getting
5.Store color value in a hash
6.Accessing Elements
7.Adding elements to a hash