From 2902169169438567b5b22d8c12e7f5f2e2a715b4 Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Mon, 22 Apr 2019 00:13:34 +0100 Subject: - Renamed script name. --- challenge-004/veesh-goldman/perl5/ch-01.pl | 18 ------------------ challenge-004/veesh-goldman/perl5/ch-02.pl | 27 --------------------------- challenge-004/veesh-goldman/perl5/ch-1.pl | 18 ++++++++++++++++++ challenge-004/veesh-goldman/perl5/ch-2.pl | 27 +++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 45 deletions(-) delete mode 100755 challenge-004/veesh-goldman/perl5/ch-01.pl delete mode 100755 challenge-004/veesh-goldman/perl5/ch-02.pl create mode 100755 challenge-004/veesh-goldman/perl5/ch-1.pl create mode 100755 challenge-004/veesh-goldman/perl5/ch-2.pl diff --git a/challenge-004/veesh-goldman/perl5/ch-01.pl b/challenge-004/veesh-goldman/perl5/ch-01.pl deleted file mode 100755 index 38cac1586e..0000000000 --- a/challenge-004/veesh-goldman/perl5/ch-01.pl +++ /dev/null @@ -1,18 +0,0 @@ -#! /usr/bin/perl - - -#Here's a little hacky way of doing this: I'm encoding the digits -#of pi in unicode characters, and then turning them back into -#digits. I get between 4 and 5 digits per chinese character (or -#math symbol). It's a bit golfy, b/c I'm assuming whitespace -#counts towards the 'length' of the script. I'm counting 'length' -#by characters, not by bytes. -use utf8;print for'3.',map ord,split//,'㝏枧⌓纀閷┞⊉◴Ⓑ銆:' - -#this is just so I can put both in the same script -; -#I assume that printing via die counts too, because print makes -#this too long. -#Arctan of 1 is actually defined as pi/4, and I get 15 digits -#precision on my box (64 bit Ubuntu Xenial) -die 4*atan2 1,1 diff --git a/challenge-004/veesh-goldman/perl5/ch-02.pl b/challenge-004/veesh-goldman/perl5/ch-02.pl deleted file mode 100755 index bac9712084..0000000000 --- a/challenge-004/veesh-goldman/perl5/ch-02.pl +++ /dev/null @@ -1,27 +0,0 @@ -#! /usr/bin/perl - -my $usage = <<"EOF"; -USAGE: -$0 letters [file] - - letters - a string consisting of the letters to filter by - file - the name of a file to check for words. If ommited, checks STDIN - -$0 will search through the file for words that can be made from -the letters in the list argument. Each letter will only be used once. -EOF - -die $usage unless @ARGV; - -my $list = shift; - -while (<>) { - #remove newline - chomp; - #copy the string to check for letters - my $string = $_; - #remove any letter in our list from the word - $string =~ s/$_//i for split //, $list; - #if there's no word left, then print our original word - CORE::say unless $string; -} diff --git a/challenge-004/veesh-goldman/perl5/ch-1.pl b/challenge-004/veesh-goldman/perl5/ch-1.pl new file mode 100755 index 0000000000..38cac1586e --- /dev/null +++ b/challenge-004/veesh-goldman/perl5/ch-1.pl @@ -0,0 +1,18 @@ +#! /usr/bin/perl + + +#Here's a little hacky way of doing this: I'm encoding the digits +#of pi in unicode characters, and then turning them back into +#digits. I get between 4 and 5 digits per chinese character (or +#math symbol). It's a bit golfy, b/c I'm assuming whitespace +#counts towards the 'length' of the script. I'm counting 'length' +#by characters, not by bytes. +use utf8;print for'3.',map ord,split//,'㝏枧⌓纀閷┞⊉◴Ⓑ銆:' + +#this is just so I can put both in the same script +; +#I assume that printing via die counts too, because print makes +#this too long. +#Arctan of 1 is actually defined as pi/4, and I get 15 digits +#precision on my box (64 bit Ubuntu Xenial) +die 4*atan2 1,1 diff --git a/challenge-004/veesh-goldman/perl5/ch-2.pl b/challenge-004/veesh-goldman/perl5/ch-2.pl new file mode 100755 index 0000000000..bac9712084 --- /dev/null +++ b/challenge-004/veesh-goldman/perl5/ch-2.pl @@ -0,0 +1,27 @@ +#! /usr/bin/perl + +my $usage = <<"EOF"; +USAGE: +$0 letters [file] + + letters - a string consisting of the letters to filter by + file - the name of a file to check for words. If ommited, checks STDIN + +$0 will search through the file for words that can be made from +the letters in the list argument. Each letter will only be used once. +EOF + +die $usage unless @ARGV; + +my $list = shift; + +while (<>) { + #remove newline + chomp; + #copy the string to check for letters + my $string = $_; + #remove any letter in our list from the word + $string =~ s/$_//i for split //, $list; + #if there's no word left, then print our original word + CORE::say unless $string; +} -- cgit