Hi, everyone. I just wanted to weigh in on this one.
<long explanation, entirely my own view>
It's a great question.
One major problem is that within Mormonism, we tend to think of perfection as the absence of sin. If you sin, you need to repent and not do it any more. It is as if the way to God is through a purging process, with which I couldn't disagree more. I often have said that getting closer to God isn't by the absence of something (sin), but by the presence of something (spirituality). Unfortunately, this verse has a strong tendency to bolster the Mormon view of Pharisaical sin-elimination (impossible), and which leads to things like "exact obedience" as an article of faith.
However, in somewhat recent times, there has been emphasis on the idea that 'perfect' in this verse is not meant in the same way that you and I think of flawlessness, but rather has the connotation of completeness, a finished product, like when you put the last touches on the home improvement project. From the world's most authoritative source, wikipedia:
The term rendered "perfect" in most English translations [of Matthew 5:48] is τέλειοι (téleioi), the same word used in the Septuagint for תָּמִים (tamím) and meaning "brought to its end, finished; lacking nothing necessary to completeness.". According to Barnes, "Originally, it is applied to a piece of mechanism, as a machine that is complete in its parts. Applied to people, it refers to completeness of parts, or perfection, where no part is defective or wanting." Some link the Gospel's use of the term with its use by the Greek philosophers. To them something was perfect if it fully be its intended function.
But, that can also still point toward the impossible ideal. What I like to do is boil it down to the context. It's the closing statement of a specific portion of the Sermon on the Mount (or Plain, in Luke) that talks about how to deal with others, and boy, is this a teaching we could sorely use in our world today. Consider the following complete passage that the final statement belongs to:
“You have heard that it was said, ‘An eye for an eye and a tooth for a tooth.’ But I say to you, Do not resist an evildoer. But if anyone strikes you on the right cheek, turn the other also; and if anyone wants to sue you and take your coat, give your cloak as well; and if anyone forces you to go one mile, go also the second mile. Give to everyone who begs from you, and do not refuse anyone who wants to borrow from you.
“You have heard that it was said, ‘You shall love your neighbor and hate your enemy.’ But I say to you, Love your enemies and pray for those who persecute you, so that you may be children of your Father in heaven; for he makes his sun rise on the evil and on the good, and sends rain on the righteous and on the unrighteous. For if you love those who love you, what reward do you have? Do not even the tax collectors do the same? And if you greet only your brothers and sisters, what more are you doing than others? Do not even the Gentiles do the same? Be perfect, therefore, as your heavenly Father is perfect. - Matthew 5:38-48, NRSV
What does "be perfect" mean in this passage? It doesn't mean "be free of all sin". You should answer for yourself before reading my interpretation in the next sentence, because your own interpretation is more important to you than mine is to you... OK, last chance, I urge you to come up with your own meaning... going... going...gone. I take it to mean that our human nature gives us prejudice and impatience toward others who aren't in our in-group. To be a finished product (perfect) like God, in this case, means to see all people with love and patience; even and especially when it is not reciprocated.
It's also interesting to compare the above passage to how Luke reported it:
“But to you who are listening I say: Love your enemies, do good to those who hate you, bless those who curse you, pray for those who mistreat you. If someone slaps you on one cheek, turn to them the other also. If someone takes your coat, do not withhold your shirt from them. Give to everyone who asks you, and if anyone takes what belongs to you, do not demand it back. Do to others as you would have them do to you.
“If you love those who love you, what credit is that to you? Even sinners love those who love them. And if you do good to those who are good to you, what credit is that to you? Even sinners do that. And if you lend to those from whom you expect repayment, what credit is that to you? Even sinners lend to sinners, expecting to be repaid in full. But love your enemies, do good to them, and lend to them without expecting to get anything back. Then your reward will be great, and you will be children of the Most High, because he is kind to the ungrateful and wicked. Be merciful, just as your Father is merciful. - Luke 6:27-35, NRSV
</long explanation, entirely my own view>