use diagnostics; open(LIST,"small.txt") or die "Can't open small.txt: $!"; @arr= ; for($i = 0; $i < @arr; $i++) { chomp($arr[$i]); print "path read from file = '$arr[$i]'\n"; #it displays => ms_qu/the/path/written/in/file (fine till here but it shud go to this place when i use chdir) chdir $arr[$i] or die "Can't change directory: $!"; print "After chdir, cwd is = "; system("pwd"); }