Please send questions to st10@humboldt.edu .
#!/usr/bin/perl -w

#######################################################
# lab02_hash1
#
# demo how one assigns a list of key-value pairs to
# a hash, and show that they're really there
#
# modified by Sharon Tuttle from "Learning Perl",
#    by Schartz and Phoenix
#
# last modified: 9-2-04
#######################################################

%order_totals = ("chocolate", 13, "hamburger", 10, "tofu dog", 12);

print "\$order_totals\{\"chocolate\"\}: $order_totals{\"chocolate\"}\n";
print "\$order_totals\{hamburger\}: $order_totals{hamburger}\n";
print "\$order_totals\{'tofu dog'\}: $order_totals{'tofu dog'}\n";

# show that variable interpolation doesn't work on hashes... 
# this just prints the string %order_totals
print "%order_totals\n"; 

# hey, but you CAN just give the hash to print --- and it'll
# print a string depiction of it; (quick'n'sleazt, though ---
# no spaces...!)   
print %order_totals, "\n";

#   CAN "unwind" into an array and print that array, though:
@hold_order_totals = %order_totals;
print "@hold_order_totals\n";


# end of lab02_hash1