in reply to Question about hashes
produces#!/usr/bin/perl -w use strict; my %h = (1 => "one", 2 => "two"); %h = (%h, 3, "three"); %h = (%h, 4, "four"); print "h is:\n",printhash(%h); sub printhash { my $i = 0; join("",map { $_.($i++%2?"\n":" => ") } @_); }
h is: 1 => one 2 => two 3 => three 4 => four
Consider using debugging information to see if your error is elsewhere---for example, printing out the contents of $file and $text whenever you add to the hash.
|
|---|