The
$^O that others have described will get you started, and for your *nix uses will be just fine. However it will only say "Win32" for any Windows OS. To require Win NT/2K/XP you can check for the value of $ENV{OS} and make sure it is "Windows_NT". It will be empty (non-existant) for the Win9x OS's. If you want more granularity than that for Windows, you need to start grubbing through the registry.
Note: I'm not sure how the Config solution above will work on something like
ActiveState which is pretty much precompiled bins.
"Nothing is sure but death and taxes" I say combine the two and its death to all taxes!