fork download
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4.  
  5. my %count_of;
  6. while (my $line = <>) { #read from file or STDIN
  7. foreach my $word (split /\s+/, $line) {
  8. $count_of{$word}++;
  9. }
  10. }
  11. print "All words and their counts: \n";
  12. for my $word (sort keys %count_of) {
  13. print "'$word': $count_of{$word}\n";
  14. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
===SORRY!===
Unable to find module 'strict' in the @*INC directories.
(@*INC contains:
  /home/D7NX7x/.perl6/lib
  /usr/lib/parrot/2.7.0/languages/perl6/lib
  .)
stdout
Standard output is empty