in reply to Read the directories from file

$input_dir =~ s{^\.\./}{/};

See perlretut.

However, it seems a bit strange to want to do it this way. If you want to do some advanced filename manipulation, I suggest Path::Class or Path::Tiny, or at the very least the core module File::Spec. All three of these also have the added advantage of being portable across OSes (Path::Tiny only does *NIX and Win32, though).

use File::Spec::Functions qw/splitdir updir catdir/; my @input_dir = splitdir $input_dir; shift @input_dir if $input_dir[0] eq updir; $input_dir = catdir(@input_dir); # $input_dir is now "set/projects/all/files"

Update: Corrected {^../} to {^\.\./}.