diff options
| author | James Smith <js5@sanger.ac.uk> | 2022-12-26 14:34:43 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-26 14:34:43 +0000 |
| commit | ef4abf511640753973a09531e3d6e4324d1b0d77 (patch) | |
| tree | 072271fbe04d7a49fd6970c989bfe1675fb4b1c2 | |
| parent | ae146d8ac3d7fd8a856be32a4367693d574d914d (diff) | |
| download | perlweeklychallenge-club-ef4abf511640753973a09531e3d6e4324d1b0d77.tar.gz perlweeklychallenge-club-ef4abf511640753973a09531e3d6e4324d1b0d77.tar.bz2 perlweeklychallenge-club-ef4abf511640753973a09531e3d6e4324d1b0d77.zip | |
Create ch-1.pl
| -rw-r--r-- | challenge-197/james-smith/perl/ch-1.pl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/challenge-197/james-smith/perl/ch-1.pl b/challenge-197/james-smith/perl/ch-1.pl new file mode 100644 index 0000000000..84b80e2164 --- /dev/null +++ b/challenge-197/james-smith/perl/ch-1.pl @@ -0,0 +1,17 @@ +#!/usr/local/bin/perl + +use strict; +use warnings; +use feature qw(say); +use Test::More; + +my @TESTS = ( + [ [1,0,3,0,0,5], '1 3 5 0 0 0' ], + [ [1,6,4], '1 6 4' ], + [ [0,1,0,2,0], '1 2 0 0 0' ], + [ [(0,1) x 100 ], "@{[ (1)x 100, (0)x 100 ]}" ], +); + +is( "@{[ move_zero(@{$_->[0]}) ]}", $_->[1] ) for @TESTS; + +sub move_zero{grep({$_}@_),grep{!$_}@_} |
