Actually, the answer here is very simple: there's no difference in meaning! Both adverbs maybe and perhaps mean the same; they convey uncertainty, a possibility. You can use either when you are not sure, when you want to say “possibly”. However, perhaps is probably a little more formal.
When can we use perhaps?
You use perhaps to express uncertainty, for example, when you do not know that something is definitely true, or when you are mentioning something that may possibly happen in the future in the way you describe. Millson regarded her thoughtfully. Perhaps she was right. In the end they lose millions, perhaps billions.
Can perhaps be used instead of maybe?
Perhaps is a synonym to maybe. Perhaps is more formal and maybe is more casual—but the difference in tone is smaller than the difference between, say, "deceased" and "pushing up daisies." Perhaps is common in academic writing. Maybe is common in conversation.