http://qs321.pair.com?node_id=1079649


in reply to Re^3: compare 2 arrays for intersect diff and commmon values
in thread compare 2 arrays for intersect diff and commmon values

Thanks for the response but if you see my code I pasted my code between . I really don't know why are you angry with me ... I am expecting output as device name which I stated in my previous reply. Please don't be angry my apologies. I am able to read my code clearing I don't know why are you saying unreadable mess .... I am again pasting it ...
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 " ); my $size = @temp_list; for ($n=0; $n < $size; $n++) { our $tempdevicelinks=$temp_list[$n][0]; DEBUG( "DEBUG: - temp plc links values $tempdevicelinks " ); 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] " ); } } }

expected output device names Also I am able to read $device and $tempdevicelinks values as "ABC-DCFE41->90" "GHJKL-poiu->78"