aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFung Cheok Yin <61836418+E7-87-83@users.noreply.github.com>2020-07-12 22:49:44 +0800
committerGitHub <noreply@github.com>2020-07-12 22:49:44 +0800
commit2a017b4374854dc8567666d50dbb38f9099da976 (patch)
treeab51a18b17cdf0327f93726b0b859f1ff52a84ac
parenta4c8767e48a2bb11f9840e0bd38917be2fa6481b (diff)
downloadperlweeklychallenge-club-2a017b4374854dc8567666d50dbb38f9099da976.tar.gz
perlweeklychallenge-club-2a017b4374854dc8567666d50dbb38f9099da976.tar.bz2
perlweeklychallenge-club-2a017b4374854dc8567666d50dbb38f9099da976.zip
Update ch-1.pl
bug and structure
-rw-r--r--challenge-068/cheok-yin-fung/perl/ch-1.pl13
1 files changed, 7 insertions, 6 deletions
diff --git a/challenge-068/cheok-yin-fung/perl/ch-1.pl b/challenge-068/cheok-yin-fung/perl/ch-1.pl
index bfffdfe43f..d17cce301f 100644
--- a/challenge-068/cheok-yin-fung/perl/ch-1.pl
+++ b/challenge-068/cheok-yin-fung/perl/ch-1.pl
@@ -15,16 +15,17 @@ if ($ARGV[0] and $ARGV[1]) {
$N = $ARGV[1];
@matrix = ();
die "parameter(s) problem" unless scalar @ARGV == ($M*$N+2);
-}
-for my $i (0..$N-1) {
- my @s = ();
- for my $j (0..$M-1) {
- push @s, $ARGV[$N*$i+$j +2 ];
+ for my $i (0..$N-1) {
+ my @s = ();
+ for my $j (0..$M-1) {
+ push @s, $ARGV[$M*$i+$j +2 ];
+ }
+ push @matrix, \@s ;
}
- push @matrix, \@s ;
}
+
my @newmatrix;
for my $i (0..$N-1) {