I am trying to save the intermediate result in an array which I am accessing in every loop of a while loop.
Following is the part of the code:
my @array_mac=();
my $index1=0;
$array_mac_sz=@array_mac;
$index1=0;
#print "$array_mac_sz\n";
if ($array_mac_sz > 0){
while ($index1 < $array_mac_sz) {
if ($array_mac[$index1] eq "$hardware" ) {
$flag4=1;
}
$index1++;
}
}
if ($flag4 == 0){
$array_mac[$array_mac_sz+1]="$hardware";
} else {
$flag4=0;
}
I am getting a warning for the statement is Bold saying
"Use of uninitialized value in string eq at search_IP_05.plx line"
Is this a serious warning. What can I possibly do to get rid of it.
What I am trying to do in this code is: save the new hardware address only if it is not already present in the array. I am sure there is a better way to do the same. I was wondering if anyone could guide me on those lines.
Thanks a lot