aboutsummaryrefslogtreecommitdiff
path: root/challenge-028/arne-sommer/perl6/binary-ascii
blob: fc516c67a72404ae7499b2f44abb55a056fe9d41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /usr/bin/env perl6

sub MAIN ($file where $file.IO && $file.IO.r)
{
  my $fh = open $file, :bin;

  while my $blob = $fh.read(1024)
  {
    for @$blob -> $byte
    {
      if $byte > 127
      {
        say "The file content is binary";
	$fh.close;
	return;
      }
    }
  }
  say "The file content is ascii";
  $fh.close;
}