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 did they choose Barabbas?
Answer: 
  John 12:12-13 (KJV)
  12On the next day much people that were come to the feast, when they heard that Jesus was coming to Jerusalem, 13Took branches of palm trees, and went forth to meet him, and cried, Hosanna: Blessed is the King of Israel that cometh in the name of the Lord.


When Jesus came into Jerusalem on Palm Sunday, the people welcomed Him as a deliverer from the oppression of Rome. They cried, "Hosanna!" which means "Save us!" They threw down palm branches, which since the time of the Maccabean revolt had been a Jewish symbol of victory (see section "3. Palm Branches" from Bible Encyclopedia and 1 Maccabees 13:51).


  John 12:14-15 (KJV)
  14And Jesus, when he had found a young ass, sat thereon; as it is written, 15Fear not, daughter of Sion: behold, thy King cometh, sitting on an ass's colt.


This prophecy is from Zechariah 9:9, and if you read the entire passage, you can see again what the Jews expected: a Messiah that would drive out their oppressors and be a physical savior.

Why did the Jews choose Barabbas instead of Jesus mere days after they welcomed Him so strongly? The other answers correctly point out that the chief priests and elders stirred the crowd against Jesus. However, the people were able to be swayed because their expectations were disappointed. Jesus didn't ride into Jerusalem on a battle charger, accepting a crown and forming an army to defeat Rome. Instead He came humbly, on a donkey, and He came not to conquer Rome, but to conquer death and sin through His sacrificial death.