From b87f31021a2e7b4c8b1661ee5f1242914f8a3d49 Mon Sep 17 00:00:00 2001 From: drbaggy Date: Sat, 28 May 2022 09:10:51 +0100 Subject: new versions --- challenge-166/james-smith/perl/ch-2-ns.pl | 2 +- challenge-166/james-smith/perl/ch-2.pl | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/challenge-166/james-smith/perl/ch-2-ns.pl b/challenge-166/james-smith/perl/ch-2-ns.pl index 489643eb9f..5e4c771a83 100644 --- a/challenge-166/james-smith/perl/ch-2-ns.pl +++ b/challenge-166/james-smith/perl/ch-2-ns.pl @@ -1,3 +1,3 @@ /\//,$u{$'.'/'x-d}{$d{$`}=$`}++for<*/*>;$lkeys%{$u{$l}}?sprintf$b,map{$u{$l}{$_}?$l:''}@p:()}sort@_),$a +',@p),$a,map({//;@p-%{$u{$'}}?sprintf$b,map{$' x$u{$'}{$_}}@p:()}sort@_),$a \ No newline at end of file diff --git a/challenge-166/james-smith/perl/ch-2.pl b/challenge-166/james-smith/perl/ch-2.pl index 90eae65eda..60462a45fd 100644 --- a/challenge-166/james-smith/perl/ch-2.pl +++ b/challenge-166/james-smith/perl/ch-2.pl @@ -30,7 +30,7 @@ sub z_diff { ## Declare variables ## my($l,%d,$F,@p,%u,$T,$H)=0; - my( $length, %directories, %filenames =0; + my( $length, %directories, %filenames)=0; ## Read all sub-directories containing files and store ## in data structure as a hash of ordered arrays @@ -146,20 +146,20 @@ sub z_diff_no_comments { say $HORIZONTAL_LINE; } -## Merging the fetch/parse into the a single function gives us just 272 bytes -## of perlly goodness {265 without the fn call overhead} +## Merging the fetch/parse into the a single function gives us just 265 bytes +## of perlly goodness {258 without the fn call overhead} #23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789# sub x{my($l,$F,%d,%u,@p)=0;/\//,$u{$'.'/'x-d}{$d{$`}=$`}++for<*/*>;$lkeys%{$u{$l}}?sprintf$b, -map{$u{$l}{$_}?$l:''}@p:()}sort@_),$a} +sprintf($b="| %-${l}s "x@p."|\n",@p),$a,map({//;@p-%{$u{$'}}?sprintf$b,map{$u{$' +}{$_}?$':''}@p:()}sort@_),$a} -## 270 bytes (263 without fn overhead) +## 263 bytes (256 without fn overhead) #23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789# sub z{my($l,$F,%d,%u,@p)=0;/\//,$u{$'.'/'x-d}{$d{$`}=$`}++for<*/*>;$lkeys%{$u{$l}}?sprintf$b,map{$u{$l}{$_}?$l:''}@p:()}sort@_ +',@p),$a,map({//;@p-%{$u{$'}}?sprintf$b,map{$u{$'}{$_}?$':''}@p:()}sort@_ ),$a} -- cgit