http://qs321.pair.com?node_id=951570

perlStuck has asked for the wisdom of the Perl Monks concerning the following question:

Hey there! Currently, I'm having troubles with Perl printing the memory location of a hash when I feel that I haven't given it sufficient cause to do so. This is a word processing tool that I'm making for myself to help in the study of foreign languages. I'm reading in English words and their foreign (in my case, German) equivalent, and storing them in a hash. When one iterates over the hash, however, Perl decides that I'm telling it to print out the hashes memory location as well as all the elements of the hash I have purposefully put in there. It's interesting to note that the hashes memory location does not receive a 'tag' from the hash_processor subroutine. Any help would be greatly appreciated.

sub add_words::main () { my %words = {}; my $english; my $foreign; until ('1' == '0') { print "Enter English: "; chomp($english = <STDIN>); print "Enter German: "; chomp($foreign = <STDIN>); if (($english && $foreign) eq '-1') { last; } ($english, $foreign) = &hash_processor::function($english, $foreign +, '0'); $words{$english} = $foreign; } foreach my $word (sort keys %words) { # First output is description of hash's mem location, and I DON'T K +NOW WHY. print "$word ==> $words{$word}\n"; } } sub hash_processor::function () { my ($english, $foreign, $process) = @_; if ($process == '0') { $english = "$english" . "$hash_processor::tag_count"; $foreign = "$foreign" . "$hash_processor::tag_count"; } $hash_processor::tag_count++; return ($english, $foreign); }

Output is something like:

HASH(0x950c5e6) ==> word ==> Wort two words ==> zwei Woerter etc. ==> usw.