[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Foreach, Hash name from <>



Hi all,

This prints "Following is the contents tc.", but not actual hash contents. Why?

Thanks I.A.A. ... John

######################################### script begin

#!

##################
# Script to accept hash name from <STDIN> and display key:value pairs
##################

# Grab the hash's name
print 'Hash to display (no "%" please): ';
$hashname = <>;
chomp $hashname;

# Display the key:value pairs

print 'Following is the contents of the hash %',$hashname,"\n";

foreach $hashkey (keys(%$hashname)) {
print "key: $hashkey, value: $hashname{$hashkey}\n";
}

*****************************************  script end



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch