aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrbaggy <js5@sanger.ac.uk>2022-05-27 05:52:34 +0100
committerdrbaggy <js5@sanger.ac.uk>2022-05-27 05:52:34 +0100
commit23f495993f7501cc15f4daa06cc2e995cc172d51 (patch)
treeca8b737f792ac1ebcd93d630246366fc569a2b22
parent543ec236aa04d6a81c691743f784b3e387330ebb (diff)
downloadperlweeklychallenge-club-23f495993f7501cc15f4daa06cc2e995cc172d51.tar.gz
perlweeklychallenge-club-23f495993f7501cc15f4daa06cc2e995cc172d51.tar.bz2
perlweeklychallenge-club-23f495993f7501cc15f4daa06cc2e995cc172d51.zip
stupid git
-rw-r--r--challenge-166/james-smith/perl/ch-2-ns.pl3
1 files changed, 3 insertions, 0 deletions
diff --git a/challenge-166/james-smith/perl/ch-2-ns.pl b/challenge-166/james-smith/perl/ch-2-ns.pl
new file mode 100644
index 0000000000..e06f9576c8
--- /dev/null
+++ b/challenge-166/james-smith/perl/ch-2-ns.pl
@@ -0,0 +1,3 @@
+(@_=split'/'),push@{$d{$_[0]}},-d?"$_[1]/":$_[1]for<*/*>;$u{$_}++for map{@{$d{$_}}}my@p=sort keys%d;$l<length?$l=length:1for@p,@_=keys%u;print$H=join('-'x($l+2),('+')x@p,'+
+'),sprintf($T="| %-${l}s "x@p.'|
+',@p),$H,map({$u{$F=$_}<@p?sprintf$T,map{$d{$_}[0]ne$F?'':shift@{$d{$_}}}@p:map{shift@{$d{$_}};()}@p}sort@_),$H \ No newline at end of file