I accidentally slept in a room filled with spilled perfume. I had hallucinations and still have a headache. What do I do? Is it dangerous?

Perhaps a migraine. Strong aromas such as perfume, may trigger a headache, but the hallucinations may represent an additional problem not usually associated with migraines. Doubt this will eventuate in lasting problems, but due to the complexities, please contact a physician and get this all checked out.
Perfume. It sounds like you had a rough night sleeping. I don't know of any reason to have hallucinations based on smelling perfume alone. Could you have also ingested a substance that caused this? I'd suggest sleeping in a better ventilated room from now on, and avoid alcohol and drug use. If the hallucinations happen again, please see your doctor.