Merge branch 'add-datefmt'
[sunny256-utils.git] / usedchars
blob79acf445a5a67ad45a4cc09e70e95154214612d7
1 #!/usr/bin/env perl
3 # usedchars
4 # File ID: 2b47bfdc-5d49-11df-83a7-90e6ba3022ac
5 # Lister ut tegn som er brukt i en fil. Bruker HTML-entities
6 # for enkelhets skyld. Kjør gjennom "h2u -l" eller recode(1).
8 use strict;
9 use warnings;
11 my $Char;
12 my %Hash; # Gjerne det
14 defined($ARGV[0]) || die("Syntax: $0 file [...]\n");
16 foreach (@ARGV) {
17 if (open(FP, "<$_")) {
18 while (sysread(FP, $Char, 1)) {
19 $Hash{$Char}++;
21 } else {
22 warn("$_: Unable to open file for read: $!");
26 while (my ($a, $b) = each %Hash) {
27 printf("&#x%02X; : %u\n", ord($a), $b);