HI ,
I have a list1 which consists of data that i have to search and a list2 which has the files that need to be searched .So basically i am using list1 on list2 to see if list1 data is present if found replace it .I have written the code using foreach loop for each list .This is taking the script longer time because the data and the number of files to be search is more....Is there a way i can reduce the time the scripting is takes? I saw somehwere we can use pipe to collect data and doa parallel serach ...but not sure on how to use it
here is teh present code that i have
@list_of_newhier1------------list1
@list_of_newhier-------------list2
foreach $other_list(@list_of_newhier1)
{
chomp(@list_of_newhier1);
if(not ($other_list=~/^\$/) and $other_list=~/\s*(.).$prefix\.([^\.\t ]+)$/)
{
$other_list=~/\s*(.).$prefix\.([^\.\t ]+)$\s*/;
$other_list1 = $1;
$other_list2=$2;
foreach $list\_of\_newhier\(@list\_of_newhier\)
\{
chomp\(@list\_of_newhier\);
open\(NEWHIER, "$dirname1/$other_list"\)or die " Can not open $other_list $! \\n";
open\(NEWHIER1, ">$dirname1/$other_list.tmp"\)or die " Can not open $other_list.tmp \\n";
while\(<NEWHIER>\)
\{
if\(/$list\_of_newhier/\)
\{
$\_=~s/\\b$list\_of\_newhier\\b/$list\_of_newhier.$prefix/ ;
\}
print NEWHIER1 $_;
\}
close\(NEWHIER\);
close\(NEWHIER1\);
$sys_err = system\("cp $dirname1/$other_list.tmp $dirname1/$other_list"\);
$sys_err = system\(" rm $dirname1/$other_list.tmp"\);
\}
\}
\}
Thanks