Peter was rash. Alone he had attacked the whole band. Jesus told him that his unseasonable and imprudent defense might be the occasion of his own destruction. In doing it he would endanger his life, for they who took the sword perished by it. It also may mean; learn how to use God's Word with Grace! Use self-control, which is listed as one of the Fruit of the Spirit. Temperance, self-self control, interestingly is the last fruit of the Spirit mentioned.
50 And Jesus said unto him, Friend, wherefore art thou come? Then came they, and laid hands on Jesus and took him. 51 And, behold, one of them which were with Jesus stretched out his hand, and drew his sword, and struck a servant of the high priest's, and smote off his ear. 52 Then said Jesus unto him, Put up again thy sword into his place: for all they that take the sword shall perish with the sword. 53 Thinkest thou that I cannot now pray to my Father, and he shall presently give me more than twelve legions of angels? (Matthew 26).
Peter used the Sword wrongly. Notice what Jesus said afterwards to all who could hear.
"53 Thinkest thou that I cannot now pray to my Father, and he shall presently give me more than twelve legions of angels? (Matthew 26) (Jesus is the Arc that brings us out of all troubled waters!)
"But the Fruit of the Spirit is Love, Joy, Peace, Long suffering, Gentleness, Goodness, Faith, Meekness, Temperance: Against such there is no law.: Gal:5:22-23).
Notice, that Peter's actions were based more on the carnal nature; he had not received the Holy Spirit yet nor was The Fruit of the Spirit yet fully developed; he lacked Temperance; acting from his first impulses.
Also there is more to see in this example of Scripture; as many Christians think they are to answer questions, with the Sword of God; not realizing that this Sword has two sides; the Blessing Side > (LIFE); The Curse Side>(DEATH) _ Jesus wanted us to know how to best utilize the Sword or Word of God and so this entire passages of Scripture has a second application to how the Word of God should be administered in and with the Spirit of Love; the Blessed side of the Sword; which doesn't cause great harm but is that which Blesses Us all.
We best all pay attention to what Jesus says in Matt: 26:53
"53 Thinkest thou that I cannot now pray to my Father, and he shall presently give me more than twelve legions of angels? (Matthew 26)