Boberts has asked for the wisdom of the Perl Monks concerning the following question:
hey everyone im trying to print a hash into a table so one shows the keys and the other the values but what im trying isn't working right now, this is what I have right now im not putting in all the code cause a lot of it is useless so im only showing the hash bits
my($words, %everything); my @countKey = keys %everything; my @countValue = values %everything; foreach my $word(split /\s+/, $input) { $everything {$word}++; $words++; } foreach $word(keys %everything) { print "$word was seen $everything{$word} times\n"; } print start_table({-border=>1}); print Tr(td('Keys'), td('Values')); print Tr(td(print("@countKey")), td(@countValue)); print end_table;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: printing a hash into a table
by hippo (Archbishop) on Mar 03, 2019 at 22:54 UTC | |
by Boberts (Novice) on Mar 03, 2019 at 23:41 UTC | |
by hippo (Archbishop) on Mar 04, 2019 at 08:58 UTC | |
by Laurent_R (Canon) on Mar 04, 2019 at 08:55 UTC | |
|
Re: printing a hash into a table
by AnomalousMonk (Archbishop) on Mar 03, 2019 at 22:57 UTC |