- or download this
my $key = "C:\\abc\\dfg";
my @example = ("C:\\abc\\dfg\\axy", "C:\\abc\\dfg\\#\@\$#\@\$\@\\hwllo
+");
...
my $rel = abs2rel($_, $key);
printf "in: %s\nout: %s\n\n", $_, $rel;
}
- or download this
in: C:\abc\dfg\axy
out: axy
...
in: C:\abc\dfg\#@$#@$@\hwllo
out: #@$#@$@\hwllo
- or download this
# modified source
use File::Spec::Functions qw(abs2rel splitdir);
...
my($topdir) = splitdir($rel);
printf "in: %s\nout: %s\ntop directory: %s\n\n", $_, $rel, $topdir
+;
}
- or download this
in: C:\abc\dfg\axy
out: axy
...
out: #@$#@$@\hwllo
top directory: #@$#@$@