diff options
| -rw-r--r-- | challenge-028/lars-thegler/README | 1 | ||||
| -rwxr-xr-x | challenge-028/lars-thegler/perl5/ch-1.pl | 21 | ||||
| -rwxr-xr-x | challenge-028/lars-thegler/perl5/ch-2.pl | 14 |
3 files changed, 36 insertions, 0 deletions
diff --git a/challenge-028/lars-thegler/README b/challenge-028/lars-thegler/README new file mode 100644 index 0000000000..db6756665d --- /dev/null +++ b/challenge-028/lars-thegler/README @@ -0,0 +1 @@ +Solution by Lars Thegler diff --git a/challenge-028/lars-thegler/perl5/ch-1.pl b/challenge-028/lars-thegler/perl5/ch-1.pl new file mode 100755 index 0000000000..ab8780f01e --- /dev/null +++ b/challenge-028/lars-thegler/perl5/ch-1.pl @@ -0,0 +1,21 @@ +#!/usr/bin/env perl + +# Challenge 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 Modern::Perl; + +my $filename = shift; + +if ( -B $filename ) { + say 'The file content is binary.'; +} elsif ( -T $filename ) { + say 'The file content is ascii.'; +} else { + say 'The file is something else.'; +} + +# The task is worded in an unfortunate way - there exists files that are neither +# binary nor ascii. My code handles that also. diff --git a/challenge-028/lars-thegler/perl5/ch-2.pl b/challenge-028/lars-thegler/perl5/ch-2.pl new file mode 100755 index 0000000000..3d4695ae9a --- /dev/null +++ b/challenge-028/lars-thegler/perl5/ch-2.pl @@ -0,0 +1,14 @@ +#!/usr/bin/env perl + +# Write a script to display Digital Clock. Feel free to be as creative as you +# can when displaying digits. We expect bare minimum something like “14:10:11”. + +use Modern::Perl; +use Time::Piece; + +$|++; + +while (1) { + print "\r",localtime->datetime; + sleep 1; +}
\ No newline at end of file |
