fork download
  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4. use warnings;
  5.  
  6. my %h = ();
  7.  
  8. foreach (<STDIN>) {
  9. $h{$_} += 1;
  10. }
  11.  
  12. while (my ($k, $v) = each %h) {
  13. print "$k $v\n";
  14. }
  15.  
Success #stdin #stdout 0.01s 5380KB
stdin
Hoge
Fuga
Foo
Fuga
Foo
Hoge
Bar
Fuga
Piyo🐤
Piyo🐤
stdout
Foo 2
Piyo🐤 2
Bar 1
Fuga 3
Hoge 2