in reply to printing a hash into a table
my($words, %everything); my @countKey = keys %everything; my @countValue = values %everything;
Declare a hash; fill two arrays with the keys and values of the empty hash (i.e., no keys or values).
foreach my $word(split /\s+/, $input) { $everything {$word}++; $words++; }
Put stuff in the hash.
foreach $word(keys %everything) { print "$word was seen $everything{$word} times\n"; }
Print the keys and values of the now non-empty hash.
print start_table({-border=>1}); print Tr(td('Keys'), td('Values')); print Tr(td(print("@countKey")), td(@countValue)); print end_table;
Use the contents of the still empty arrays previously filled from what was an empty hash to build a table.
Give a man a fish: <%-{-{-{-<
|
|---|