diff options
| author | Doomtrain14 <yet.ebreo@gmail.com> | 2019-08-25 13:22:48 +0800 |
|---|---|---|
| committer | Doomtrain14 <yet.ebreo@gmail.com> | 2019-08-25 13:22:48 +0800 |
| commit | ef987715e48bd087bba05e1f356be5f75e0c35a2 (patch) | |
| tree | aa376d1d8c6ad148ba8d67250d984defbc140dd2 /challenge-001 | |
| parent | c539574b35bc90a795269082980ebca7d8c1b81e (diff) | |
| download | perlweeklychallenge-club-ef987715e48bd087bba05e1f356be5f75e0c35a2.tar.gz perlweeklychallenge-club-ef987715e48bd087bba05e1f356be5f75e0c35a2.tar.bz2 perlweeklychallenge-club-ef987715e48bd087bba05e1f356be5f75e0c35a2.zip | |
Added solutions for challenge #1
Diffstat (limited to 'challenge-001')
| -rw-r--r-- | challenge-001/yet-ebreo/README | 1 | ||||
| -rw-r--r-- | challenge-001/yet-ebreo/perl5/ch-1.pl | 12 | ||||
| -rw-r--r-- | challenge-001/yet-ebreo/perl5/ch-2.sh | 6 |
3 files changed, 19 insertions, 0 deletions
diff --git a/challenge-001/yet-ebreo/README b/challenge-001/yet-ebreo/README new file mode 100644 index 0000000000..c44a8ce2be --- /dev/null +++ b/challenge-001/yet-ebreo/README @@ -0,0 +1 @@ +Solution by Yet Ebreo diff --git a/challenge-001/yet-ebreo/perl5/ch-1.pl b/challenge-001/yet-ebreo/perl5/ch-1.pl new file mode 100644 index 0000000000..81e65b7b40 --- /dev/null +++ b/challenge-001/yet-ebreo/perl5/ch-1.pl @@ -0,0 +1,12 @@ +#Write a script to replace the character ‘e’ with ‘E’ in the string ‘Perl Weekly +#Challenge’. Also print the number of times the character ‘e’ is found in the string. +use 5.010; +sub get_e { + return $_[0]=~y/e/E/; +} + +my $string = "Perl Weekly Challenge"; +my $count = get_e( $string ); + +say "Resulting string: $string"; +say "Replaced e: $count times";
\ No newline at end of file diff --git a/challenge-001/yet-ebreo/perl5/ch-2.sh b/challenge-001/yet-ebreo/perl5/ch-2.sh new file mode 100644 index 0000000000..5c2ccf9392 --- /dev/null +++ b/challenge-001/yet-ebreo/perl5/ch-2.sh @@ -0,0 +1,6 @@ +# Write a one-liner to solve the FizzBuzz problem and print the numbers 1 through 20. +# However, any number divisible by 3 should be replaced by the word ‘fizz’ and +# any divisible by 5 by the word ‘buzz’. Those numbers that are both divisible +# by 3 and 5 become ‘fizzbuzz’. + +perl -E 'say $_ % 15?$_ % 5?$_ % 3?$_:fizz:buzz:fizzbuzz for 1..20'
\ No newline at end of file |
