Mercurial > hg > Members > anatofuz > anatofuz-tools
comparison perl-wc @ 0:78df974566a7
initial commit
author | Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 12 Nov 2018 19:56:42 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:78df974566a7 |
---|---|
1 #!/usr/bin/perl | |
2 use strict; | |
3 use warnings; | |
4 use Encode; | |
5 | |
6 my $buffer = do { local $/; <>; }; | |
7 | |
8 my $strings = decode_utf8($buffer); | |
9 | |
10 my $lines = $strings =~ s/\n/\n/g || 1; | |
11 my $chars = length($strings); | |
12 my $bytes = length($buffer); | |
13 | |
14 print "lines: $lines\n"; | |
15 print "chars: $chars\n"; | |
16 print "bytes: $bytes\n"; |