aboutsummaryrefslogtreecommitdiff
path: root/challenge-028/feng-chang/perl6/ch-1.p6
blob: 921a792defaa7adfccc09d408f43bf67c42111f5 (plain)
1
2
3
4
5
6
7
8
9
10
#!/bin/env perl6

sub is-ascii(uint8 $c --> Bool)
{ 9 <= $c <= 13 or 32 <= $c <= 126 }

sub MAIN(Str:D $file-name where *.IO.e) {
    print 'the file content is ';
    say   ([and] open($file-name, :r).read(16).list».&{ is-ascii($_) }) ??
              'ascii' !! 'binary';
}