P
prasanna bhat mavinkuli
Hi all,
Iam wet behind the ears as for as Perl is concerned. I have got
a problem, well its a real puzzle for a fresher like me.
In my code i just want to create a source directory structure in
a target directory. I am finding all the subdirectories in the
source directory and creating it in the target directory during run
time. And i am failing to do so because directory name
contains(+,- etc). So its a metacharacter problem. Also I want to
retain the directory names as it is. So here is the piece of
code, but i have initialized values for the arrays to illustrate,
@stor_array=("/dir+a/dir2","/dir+a/dir2/lost+found/","/dir+a/dir2/kallu+mat","/dir+a/dir2/kallu+mat","/dir+a/dir2/kallu+ma-jon");
$dir="dir+a";
$temp="target";
foreach (@stor_array){
s/$dir/$temp\/Files\//;
print $_ ,"\n";
}
Please somebody help me to achieve the replacement.
thanks in advance
Prasanna Bhat Mavinkuli
Iam wet behind the ears as for as Perl is concerned. I have got
a problem, well its a real puzzle for a fresher like me.
In my code i just want to create a source directory structure in
a target directory. I am finding all the subdirectories in the
source directory and creating it in the target directory during run
time. And i am failing to do so because directory name
contains(+,- etc). So its a metacharacter problem. Also I want to
retain the directory names as it is. So here is the piece of
code, but i have initialized values for the arrays to illustrate,
@stor_array=("/dir+a/dir2","/dir+a/dir2/lost+found/","/dir+a/dir2/kallu+mat","/dir+a/dir2/kallu+mat","/dir+a/dir2/kallu+ma-jon");
$dir="dir+a";
$temp="target";
foreach (@stor_array){
s/$dir/$temp\/Files\//;
print $_ ,"\n";
}
Please somebody help me to achieve the replacement.
thanks in advance
Prasanna Bhat Mavinkuli