aboutsummaryrefslogtreecommitdiff
path: root/challenge-028/arne-sommer/perl6/binary-utf
blob: cc52cc0da9fb03e2e375d183c44170b08ae041f5 (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

use Data::TextOrBinary;

sub MAIN ($file)
{
  if $file.IO.d
  {
    say "Directory.";
  }
  elsif $file.IO.e
  {
    say is-text($file.IO)
      ?? "Text file."
      !! "Binary file.";
  }
  else
  {
    say "File doesn't exist.";
  }
}