aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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