aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2019-10-01 14:37:22 +0100
committerGitHub <noreply@github.com>2019-10-01 14:37:22 +0100
commited49aac78a5a22af6d961ada7bf1ec54ef223675 (patch)
treeabdfc1c70795bb41688c7001d87e7a5b4a187dd9
parent8612a4093e50580a7ad9d76c4678f79bc9e9bd8b (diff)
parent0aa5b6a9e6060d65699ebe7d6e427521baadc769 (diff)
downloadperlweeklychallenge-club-ed49aac78a5a22af6d961ada7bf1ec54ef223675.tar.gz
perlweeklychallenge-club-ed49aac78a5a22af6d961ada7bf1ec54ef223675.tar.bz2
perlweeklychallenge-club-ed49aac78a5a22af6d961ada7bf1ec54ef223675.zip
Merge pull request #696 from oWnOIzRi/week28
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";