diff options
| author | Doomtrain14 <yet.ebreo@gmail.com> | 2019-08-25 16:22:12 +0800 |
|---|---|---|
| committer | Doomtrain14 <yet.ebreo@gmail.com> | 2019-08-25 16:22:12 +0800 |
| commit | c07b083263332bb3190a4e77e227ed3a2ae71220 (patch) | |
| tree | 0b9fe3df2d19357e01555ff1b3387d6b0a69d5e2 /challenge-001 | |
| parent | 2f72acabd6c7ad18143b3b5284a8190a9449cdd2 (diff) | |
| download | perlweeklychallenge-club-c07b083263332bb3190a4e77e227ed3a2ae71220.tar.gz perlweeklychallenge-club-c07b083263332bb3190a4e77e227ed3a2ae71220.tar.bz2 perlweeklychallenge-club-c07b083263332bb3190a4e77e227ed3a2ae71220.zip | |
Added solutions for Week #1
Diffstat (limited to 'challenge-001')
| -rw-r--r-- | challenge-001/yet-ebreo/perl6/ch-1.p6 | 10 | ||||
| -rw-r--r-- | challenge-001/yet-ebreo/perl6/ch-2.sh | 6 |
2 files changed, 16 insertions, 0 deletions
diff --git a/challenge-001/yet-ebreo/perl6/ch-1.p6 b/challenge-001/yet-ebreo/perl6/ch-1.p6 new file mode 100644 index 0000000000..22188f9938 --- /dev/null +++ b/challenge-001/yet-ebreo/perl6/ch-1.p6 @@ -0,0 +1,10 @@ +#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. + +my $string = "Perl Weekly Challenge"; +my @count = $string~~m:g/e/ ; +$string~~tr/e/E/; + + +say "Resulting string: $string"; +say "Replaced e: "~0+@count~" times";
\ No newline at end of file diff --git a/challenge-001/yet-ebreo/perl6/ch-2.sh b/challenge-001/yet-ebreo/perl6/ch-2.sh new file mode 100644 index 0000000000..5c2ccf9392 --- /dev/null +++ b/challenge-001/yet-ebreo/perl6/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 |
