Cool File & Directory Modules File::Spec 55 of 69 : prev | index | next

File::Spec

abs2rel & rel2abs

  use File::Spec;
  $rel_path = File::Spec->abs2rel( $path ) ;
  $rel_path = File::Spec->abs2rel( $path, $base ) ;
  $abs_path = File::Spec->rel2abs( $path ) ;
  $abs_path = File::Spec->rel2abs( $path, $base ) ;
  • abs2rel() takes a destination path and an optional base path returns a relative path from the base path to the destination path
  • rel2abs() converts a relative path to an absolute path

© 2003 Barbie - barbie@missbarbell.co.uk contents http://birmingham.pm.org/