summaryrefslogtreecommitdiff
path: root/sample/occur.pl
diff options
context:
space:
mode:
Diffstat (limited to 'sample/occur.pl')
-rw-r--r--sample/occur.pl9
1 files changed, 9 insertions, 0 deletions
diff --git a/sample/occur.pl b/sample/occur.pl
new file mode 100644
index 0000000..1f5fcf2
--- /dev/null
+++ b/sample/occur.pl
@@ -0,0 +1,9 @@
+while (<>) {
+ for (split(/\W+/)) {
+ $freq{$_}++;
+ }
+}
+
+for (sort keys %freq) {
+ print "$_ -- $freq{$_}\n";
+}