diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2019-09-30 18:11:43 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-09-30 18:11:43 +0100 |
| commit | 9daa7aefbc857bbd366a474a30aa62505edc7ab0 (patch) | |
| tree | d30d7a7a8a553e0a1f3094eeae98215ad9856443 | |
| parent | f71512155064d48500b2727bb624b8205cee64b0 (diff) | |
| parent | 472008a0c6a86d12f4c12515d0f6c20533c53d16 (diff) | |
| download | perlweeklychallenge-club-9daa7aefbc857bbd366a474a30aa62505edc7ab0.tar.gz perlweeklychallenge-club-9daa7aefbc857bbd366a474a30aa62505edc7ab0.tar.bz2 perlweeklychallenge-club-9daa7aefbc857bbd366a474a30aa62505edc7ab0.zip | |
Merge pull request #688 from Doomtrain14/master
Added perl5 solution ch#28-2
| -rw-r--r-- | challenge-028/yet-ebreo/perl5/ch-2.pl | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/challenge-028/yet-ebreo/perl5/ch-2.pl b/challenge-028/yet-ebreo/perl5/ch-2.pl new file mode 100644 index 0000000000..0a21971e33 --- /dev/null +++ b/challenge-028/yet-ebreo/perl5/ch-2.pl @@ -0,0 +1,60 @@ +# 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 strict; +use warnings; +use v5.10; + +require Term::Screen::Uni; +my $scr = new Term::Screen::Uni; +$scr->clrscr(); + +my @ascii_num= ( + [" 0000 "," 00 00 "," 00 00 "," 00 00 "," 0000 "], + [" 11 "," 11 "," 11 "," 11 "," 11 "], + [" 222222 "," 22 "," 222222 "," 22 "," 222222 "], + [" 333333 "," 33 "," 333333 "," 33 "," 333333 "], + [" 44 44 "," 44 44 "," 444444 "," 44 "," 44 "], + [" 555555 "," 55 "," 555555 "," 55 "," 555555 "], + [" 666666 "," 66 "," 666666 "," 66 66 "," 666666 "], + [" 777777 "," 77 "," 77 "," 77 "," 77 "], + [" 888888 "," 88 88 "," 888888 "," 88 88 "," 888888 "], + [" 999999 "," 99 99 "," 999999 "," 99 "," 999999 "], + [" :: "," :: "," "," :: "," :: "], + [" "," "," "," "," "] +); +my $toggler = 1; +while (1) { + my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(); + my $dig_time = (sprintf ("%02d:%02d:%02d", $hour,$min,$sec)); + my @printline; + + $toggler = !$toggler; + for ($dig_time=~/./g) { + if (/:/) { + for my $i (0..4) { + $printline[$i] .= $ascii_num[($toggler)?10:11][$i]; + } + } else { + for my $i (0..4) { + $printline[$i] .= $ascii_num[$_][$i]; + } + } + } + for my $i (0..4) { + $scr->at($i,0); + print $printline[$i]; + } + $scr->at(6,0); + print "Today is ".qw(Monday Tuesday Wednesday Thursday Friday Saturday Sunday)[$wday-1].": ".qw(January February March April May June July August September October November December)[$mon]." $mday, ".(1900+$year); + select(undef, undef, undef, 0.5); +} + +=begin + 0000 0000 :: 555555 333333 :: 333333 333333 + 00 00 00 00 :: 55 33 :: 33 33 + 00 00 00 00 555555 333333 333333 333333 + 00 00 00 00 :: 55 33 :: 33 33 + 0000 0000 :: 555555 333333 :: 333333 333333 + +Today is Tuesday: October 1, 2019 +=cut
\ No newline at end of file |
