in reply to Re^2: Add colums and rows
in thread Add colums and rows
i can open a file handle but I dont know how to print the entire table to a file
Let's assume you opened filehandle REPORT. The following code from Grandfather
for my $word (sort keys %freqs) { $freqs{$word}{$_} ||= 0 for keys %{$freqs{all}}; printf "$word\t"; print join "\t", join "\t", map $freqs{$word}{$_}, sort keys % +{$freqs{$word}}; print "\n"; }
could be changed to:
for my $word (sort keys %freqs) { $freqs{$word}{$_} ||= 0 for keys %{$freqs{all}}; printf REPORT "$word\t"; print REPORT join "\t", join "\t", map $freqs{$word}{$_}, sort + keys %{$freqs{$word}}; print REPORT "\n"; }
The next thing, can I modify this to count the shared words between stories, too?Certainly. Will you be reading several stories from the same DATA block? Then you don't need to change a thing.
Will you change the program to read from several different input files? How do you want to give those filenames to your program?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Add colums and rows
by lechateau (Initiate) on Apr 22, 2008 at 13:12 UTC |