genorg.pl
changeset 15 c8e6e4e514f3
parent 14 31e45dd2a894
child 16 be331e8c8caf
equal deleted inserted replaced
14:31e45dd2a894 15:c8e6e4e514f3
   225   close $fh;
   225   close $fh;
   226 }
   226 }
   227 
   227 
   228 # Reletive file from the perspect of file1, to file2
   228 # Reletive file from the perspect of file1, to file2
   229 sub prel_path ($from, $to) {
   229 sub prel_path ($from, $to) {
   230   return $to if $from eq $to;
   230   return $to =~ s!^/!!r if $from eq $to;
   231   my \(@f1, @f2) = map [m{/[^/]+}g], ($from, $to);
   231   my \(@f1, @f2) = map [m{/[^/]+}g], ($from, $to);
   232   # return substr($f1[$#f1], 1) if $from =~ $to;
   232   # return substr($f1[$#f1], 1) if $from =~ $to;
   233   while (@f1 && @f2 && $f1[0] =~ $f2[0]) {
   233   while (@f1 && @f2 && $f1[0] =~ $f2[0]) {
   234     shift @f1;
   234     shift @f1;
   235     shift @f2;
   235     shift @f2;