cleanup path to pass use it in substr

See http://irclog.perlgeek.de/perl6/2013-11-25#i_7914075