use File::Spec; $rel_path= File::Spec->abs2rel( $abs_path );