num.pl 212 B

1234567891011121314151617
  1. #!/usr/local/bin/perl
  2. #node 10 -> 4
  3. while (<>)
  4. {
  5. next unless /^node/;
  6. chop;
  7. @a=split;
  8. $num{$a[3]}++;
  9. }
  10. @a=sort {$a <=> $b } keys %num;
  11. foreach (0 .. $a[$#a])
  12. {
  13. printf "%4d:%4d\n",$_,$num{$_};
  14. }