I am new to programming and hence I am stuck on a basic level problem.

Following is code I wrote for comparison. But the result I get does not make sense to me. I would appreciate if someone could tell me what is going wrong. 

There are two arrays: @array1 , @array2 of unequal length. 

I wish to compare both and list down values not present in @array1.

my %temp = map {$_,$_}@array2;
for (@array1){
next if exists $temp{$_};
open (FILE, "&gt;&gt;/filename") or die "$!";
print FILE "$_\n";
close(FILE);
}



Question: Why don't wifi managers remember mac addresses for hotspots to defeat the jasager attack?
Answer: Convenience, mostly: 


I'm now historically using my third AP device - each one has been completely different make and vendor, but as long as the configuration stayed the same (SSID, encryption mode, passphrase), there was no need to re-enter the AP data on any of the client devices. This may not be enough of an issue in a home setting; if you have hundreds of devices which can connect to the network, reconfiguring them when an AP dies would be a royal pain.
Likewise, having multiple identically-configured APs (and thus a larger signal-covered area), the client devices will switch to the AP with the strongest signal without trouble. A few frames may be lost before the new MAC address location propagates through the local network, but overall the roaming is close to seamless.


As for the "only connect to this AP if it has a specific MAC address" - this is already possible with NetworkManager on Linux: there is an option to specify the AP's BSSID, which should be the AP's MAC address (of course, the BSSID can be spoofed - hence "should").