Use $^O. It holds the name of the OS you're currently running on, and you can use it in conditional code all you like. It's the traditional way to do this sort of thing in perl. For conditional inclusion, throw things in a BEGIN block with require and import: