aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Wilson <steven1170@zoho.eu>2019-10-01 14:12:42 +0100
committerSteven Wilson <steven1170@zoho.eu>2019-10-01 14:12:42 +0100
commit0aa5b6a9e6060d65699ebe7d6e427521baadc769 (patch)
tree490beec267c03bd69466c7ad6fd90a689f345652
parent5476167f21c01dbd6284349bad59658e27284e09 (diff)
downloadperlweeklychallenge-club-0aa5b6a9e6060d65699ebe7d6e427521baadc769.tar.gz
perlweeklychallenge-club-0aa5b6a9e6060d65699ebe7d6e427521baadc769.tar.bz2
perlweeklychallenge-club-0aa5b6a9e6060d65699ebe7d6e427521baadc769.zip
add week 28 task 1
-rw-r--r--challenge-028/steven-wilson/perl5/ch-1.pl23
1 files changed, 23 insertions, 0 deletions
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";