my @output= map{ $data=~s/C_USERNAME/$_/rg} @arr; my @output1= map{ $data=~s/IP/$_/rg} @arr1;