Hi Team, I am getting output as difference links values ARRAY(0x34276a0) intersect links values union links values ARRAY(0x34276a0). Please please help me why and where to do changes to make correct values appeared on difference ,intersection and union. Actaully after finding the difference I want to remove it from dataset ..Firstly I have tried a lot to find correct answers on different sites and finally landed here...please helppp meee..
sub updatedevice() { my $n = {}; my $Device_LINK = $server->object("ICF_PersistentDataSet",$devicelinks +); my $Temp_Device_LINK = $server->object("ICF_PersistentDataSet",$tempde +vicelinks); my @current_devicelist = @{ $Device_LINK->invoke("get") }; my @temp_devicelist = @{ $Temp_Device_LINK->invoke("get") }; my %temp_list; my %current_list; my $size = @current_list; for ($n=0; $n < $size; $n++) { our $device=$current_list[$n][0]; DEBUG( "DEBUG: - devicelinks values $device " ); --- > abl +e to print this value of device "ABC-DCFE41->90" my $size = @temp_list; for ($n=0; $n < $size; $n++) { our $tempdevicelinks=$temp_list[$n][0]; DEBUG( "DEBUG: - temp plc links values $tempdevicelinks " ); --- > abl +e to print this value of device "GHJKL-poiu->78" my %count = (); foreach my $device (@current_list, @temp_devicelist) { $count{$device}++; } my @difference = grep { $count{$_} == 1 } keys %count; my @intersect = grep { $count{$_} == 2 } keys %count; my @union = keys %count; DEBUG( "DEBUG: - difference links values $difference[0] " ); DEBUG( "DEBUG: - intersect links values $intersect[0] " ); DEBUG( "DEBUG: - union links values $union[0] " ); } } }
In reply to compare 2 arrays for intersect diff and commmon values by rasgolla
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |