I have a list of paths in a file => small.txt
i wish to open that file, copy the path and change my directory to the path collected from small.txt.
Now im not able to change my directory to the path in $arr[$i]. it shows me the die msg and doesnt change pwd.
format of path in small.txt:
xyx/abs/def/ijk
Although if i write chdir(/abc/def/ijk), it works fine but i want chdir($variable ) where value of variable is collected from small.txt
PLEASE PLEASE PLEASE HELP ME!!!
i wish to open that file, copy the path and change my directory to the path collected from small.txt.
Code:
open(LIST,"small.txt") or die "Cant open small.txt";
@arr= <LIST>;
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
chdir $arr[$i] or die "$1";
print "After chdir, cwd is = ";
system("pwd");
}
Now im not able to change my directory to the path in $arr[$i]. it shows me the die msg and doesnt change pwd.
format of path in small.txt:
xyx/abs/def/ijk
Although if i write chdir(/abc/def/ijk), it works fine but i want chdir($variable ) where value of variable is collected from small.txt
PLEASE PLEASE PLEASE HELP ME!!!
Comment