Thanks for looking into my script, I got it was I was looking for, the script was good with few mistakes but the main problem was that my array was treating the complete list of ip and subnets as 1 element so had to split them and everything worked out fine
final script
my @finalnwlist = split (/\n/, join (' ', @networklist, @brnwlist, @vn
+wlist));
my @entries;
sub update_exports {
my $exports = 'exports';
open (EXPORTS,"<exports") ||die "Error opening exports file";
my @lines = <EXPORTS>;
close (EXPORTS);
open (TMP_EXP, ">> exports_tmp") || die "File not found";
foreach $a (@lines) {
if ( $a =~ m/\*/) {
logmsg "Generating unrestricted entry..";
my ($share, $permission) = split (/\*/, $a);
for my $b (@finalnwlist) {
@entries = join ('', $share, $b, $permission)
+;
print TMP_EXP @entries;
}
}
else {
print TMP_EXP $a;
}
}
close(TMP_EXP);
}