diff options
| author | drbaggy <js5@sanger.ac.uk> | 2021-06-07 21:12:31 +0100 |
|---|---|---|
| committer | drbaggy <js5@sanger.ac.uk> | 2021-06-07 21:12:31 +0100 |
| commit | 1bfffd7dd74a4c9e96dde778ad07187e4128e56d (patch) | |
| tree | 1ee05adf607a4862d52730dafcd8ef8c8b2e016c /challenge-116/james-smith | |
| parent | d172cadef5609efeb80afef11a4df66ce0d24144 (diff) | |
| download | perlweeklychallenge-club-1bfffd7dd74a4c9e96dde778ad07187e4128e56d.tar.gz perlweeklychallenge-club-1bfffd7dd74a4c9e96dde778ad07187e4128e56d.tar.bz2 perlweeklychallenge-club-1bfffd7dd74a4c9e96dde778ad07187e4128e56d.zip | |
added in optimization
Diffstat (limited to 'challenge-116/james-smith')
| -rw-r--r-- | challenge-116/james-smith/perl/ch-1.pl | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/challenge-116/james-smith/perl/ch-1.pl b/challenge-116/james-smith/perl/ch-1.pl index ffc9471780..43d9d42427 100644 --- a/challenge-116/james-smith/perl/ch-1.pl +++ b/challenge-116/james-smith/perl/ch-1.pl @@ -37,8 +37,7 @@ cmpthese( 200, { sub splitnum { my( $in, $start ) = ( shift, '' ); - #for( split //, substr $in, 0, (length $in) >> 1) { - for( split //, $in ) { + for( split //, substr $in, 0, (length $in) >> 1) { ## $start contains the first number of sequence ## each time through the loop we will add the ## next digit eg 1, 12, 123 @@ -72,10 +71,10 @@ sub splitnum { ## length of $n - but only really valid if you are getting very large ## values of $n...} -## Below is the code above with the commends removed +## Below is the code above with the comments removed sub splitnum_no_comments { my( $in, $st ) = ( shift, '' ); - for( split //, substr $in, 0, ( length $in) >> 1) { + for( split //, substr $in, 0, (length $in) >> 1) { my @r = ( my $t = my $en = $st .= $_ ); ($t .= ++$en) && push @r,$en while $in gt $t && length $in > length $t; |
