I have a file containing something like that
NOD 111:119
NOD 11 12 13 14 15 16 17 18 19 20
NOD 101:109 91:100
DELNOD 21:29 2 3
111:119 means nodes 111 112 ... 119
so I have to sort the (array or hash) of NODs then romove the array of DELNOD from it
So i expect an output of an array or hash containing nodes only existing in NOD array.
thanks in advance
NOD 111:119
NOD 11 12 13 14 15 16 17 18 19 20
NOD 101:109 91:100
DELNOD 21:29 2 3
111:119 means nodes 111 112 ... 119
so I have to sort the (array or hash) of NODs then romove the array of DELNOD from it
So i expect an output of an array or hash containing nodes only existing in NOD array.
Code:
@pc_data = <DAT_PC>;
close (DAT_PC);
$i = 0;
foreach $data (@pc_data)
{
if ($data=~ m/\bNOD\b/)
{
$nod_entity_list=substr("$pc_data[$i]", 12, 80);
$i++;
@arr_nod_entity_list=split(' ',$nod_entity_list);
foreach $data1 (@arr_nod_entity_list) {
if ($data1=~ m/(\d+):(\d+)/)
{#pop @arr_nod_entity_list;
@range=($1.. $2);
push @arr_nod_entity_list,@range;
}
}
push @allnod,@arr_nod_entity_list;
#print"@allnod\n";
@sorted_nod_entity_list=sort {$a<=>$b} @allnod;
print "@sorted_nod_entity_list\n";
}
if ($data=~ m/\sDELNOD/)
{$del_nod_entity_list=substr("$pc_data[$i]", 12, 80);
$i++;
@del_arr_nod_entity_list=split(' ',$del_nod_entity_list);
push @del_allnod,@del_arr_nod_entity_list;
@del_sorted_nod_entity_list=sort {$a<=>$b} @del_allnod;
}
}
thanks in advance