aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2022-12-28 09:14:31 +0000
committerGitHub <noreply@github.com>2022-12-28 09:14:31 +0000
commit715eeb71f84e0fa8053ef87419efc02858a5462a (patch)
tree49b01aa30abcf4a59af3faf71e8c67fe8cafc638
parent9720dd7a3a5d6c22d6cc034c363d1d09e309e745 (diff)
parentd15252dde06495df359ebd2e176aae5a87803823 (diff)
downloadperlweeklychallenge-club-715eeb71f84e0fa8053ef87419efc02858a5462a.tar.gz
perlweeklychallenge-club-715eeb71f84e0fa8053ef87419efc02858a5462a.tar.bz2
perlweeklychallenge-club-715eeb71f84e0fa8053ef87419efc02858a5462a.zip
Merge pull request #7320 from wlmb/challenges
Challenges
-rwxr-xr-xchallenge-197/wlmb/perl/ch-1a.pl13
1 files changed, 13 insertions, 0 deletions
diff --git a/challenge-197/wlmb/perl/ch-1a.pl b/challenge-197/wlmb/perl/ch-1a.pl
new file mode 100755
index 0000000000..69d0ca3aca
--- /dev/null
+++ b/challenge-197/wlmb/perl/ch-1a.pl
@@ -0,0 +1,13 @@
+#!/usr/bin/env perl
+# Perl weekly challenge 197
+# Task 1: Move Zero. Slightly faster
+#
+# See https://wlmb.github.io/2022/12/26/PWC197/#task-1-move-zero
+use v5.36;
+say(<<~"FIN"), exit unless @ARGV;
+ Usage: $0 N1 [N2...]
+ to move all zeroes among the numbers N1, N2... towards the right,
+ keeping the order of the rest.
+ FIN
+my $count=0;
+say join " ", @ARGV, "->", (grep {$_||++$count;$_} @ARGV), ((0)x$count);