From 0aa5b6a9e6060d65699ebe7d6e427521baadc769 Mon Sep 17 00:00:00 2001 From: Steven Wilson Date: Tue, 1 Oct 2019 14:12:42 +0100 Subject: add week 28 task 1 --- challenge-028/steven-wilson/perl5/ch-1.pl | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 challenge-028/steven-wilson/perl5/ch-1.pl diff --git a/challenge-028/steven-wilson/perl5/ch-1.pl b/challenge-028/steven-wilson/perl5/ch-1.pl new file mode 100644 index 0000000000..133a81a4ce --- /dev/null +++ b/challenge-028/steven-wilson/perl5/ch-1.pl @@ -0,0 +1,23 @@ +#!/usr/bin/env perl +# Author: Steven Wilson +# Date: 2019-10-01 +# Week: 028 + +# Task #1 +# Write a script to check the file content without explicitly reading +# the content. It should accept file name with path as command line +# argument and print “The file content is binary.” or else “The file +# content is ascii.” accordingly. + + +use strict; +use warnings; +use feature qw/ say /; +use File::Type; + + +my $filename = $ARGV[0]; +my $ft = File::Type->new(); +my $type = $ft->mime_type($filename); + +say "The file contents is $type"; -- cgit