diff options
| -rw-r--r-- | challenge-101/james-smith/perl/ch-1.pl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/challenge-101/james-smith/perl/ch-1.pl b/challenge-101/james-smith/perl/ch-1.pl index b223880b14..c3b75a4ff6 100644 --- a/challenge-101/james-smith/perl/ch-1.pl +++ b/challenge-101/james-smith/perl/ch-1.pl @@ -21,7 +21,7 @@ sub pack_spiral { ## no greater than columns as printing is neater - but for no ## other reason... - my( $rows ) = reverse grep { ! (@_ % $_) } 1 .. sqrt @_; + my( $rows ) = reverse grep { ! (@_ % $_) } 1 .. sqrt @_; my( $cols, $r, $c, @out ) = ( @_/$rows, $rows-1, -1 ); ## We start bottom left... @@ -32,7 +32,7 @@ sub pack_spiral { while( @_ ) { # do until empty $out[ $r ][ ++$c ] = shift foreach 1 .. $cols--; # >> $out[ --$r ][ $c ] = shift foreach 1 .. --$rows; # ^^ - last unless @_; # exit if empty + last unless @_; # exit if empty $out[ $r ][ --$c ] = shift foreach 1 .. $cols--; # << $out[ ++$r ][ $c ] = shift foreach 1 .. --$rows; # vv } |
