Hello All,
I have a small query about this code. I had earlier asked you this
problem, but that time I had mentioned the directories in terms of
number s and so it was easier to use foreach loop. But now i need to
create directories which is a mixture of variables and number and then
I need to copy the file and give the respective folder name to the file.
Could anyone let me know if I could go for loop for this code
#!\usr\bin\perl
use warnings;
mkdir("F:/usr/eg/abc", 0777) || print $!;
mkdir("F:/usr/eg/abc/FD", 0777) || print $!;
mkdir("F:/usr/eg/pqt", 0777) || print $!;
mkdir("F:/usr/eg/pqt/FD", 0777) || print $!;
mkdir("F:/usr/eg/sde", 0777) || print $!;
mkdir("F:/usr/eg/sde/FD", 0777) || print $!;
print "Enter the file to copy: ";
$fl = <>;
chomp($fl);
use File::Copy;
copy('F:/usr/eg/z/z.txt','F:/usr/eg/abc/FD');
rename('F:/usr/eg/abc/FD/z.txt','F:/usr/eg/abc/FD/abc.txt');
copy('F:/usr/eg/z/z.txt','F:/usr/eg/pqt/FD');
rename('F:/usr/eg/pqt/FD/z.txt','F:/usr/eg/pqt/FD/pqt.txt');
copy('F:/usr/eg/z/z.txt','F:/usr/eg/sde/FD');
rename('F:/usr/eg/sde/FD/z.txt','F:/usr/eg/sde/FD/sde.txt');
Regards,
Ramesh