Show us what you have tried, what you expected it to do, and how you think it failed. This will give you (and others attempting to learn from this site) a better experience.
A slightly simpler approach than jdrago999's above is to use these built-in perl functions to achieve your objective:
opendir, readdir, closedir.
You will need to use the "-d" and "-f" operators to distinguish between directory names and file names. See -X for information on this.
I hope life isn't a big joke, because I don't get it.