aboutsummaryrefslogtreecommitdiff
path: root/challenge-112
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-112')
-rw-r--r--challenge-112/james-smith/perl/ch-1.pl3
1 files changed, 1 insertions, 2 deletions
diff --git a/challenge-112/james-smith/perl/ch-1.pl b/challenge-112/james-smith/perl/ch-1.pl
index 427b1bd0e5..c6248e80da 100644
--- a/challenge-112/james-smith/perl/ch-1.pl
+++ b/challenge-112/james-smith/perl/ch-1.pl
@@ -64,9 +64,8 @@ sub canonical_path {
}
sub canonical_path_compact {
-$a=1,@_=grep {''ne$_&&'.'ne$_}split/\//,shift;
+$a=1,@_=grep{!/^\.?$/}split/\//,shift;
$_[$a]ne'..'?$a++:$a?splice@_,--$a,2:shift while$a<@_;
'/'.join'/',@_;
}
-