in reply to Porting code between NT/Unix

Yes, the $^O variable is what you're looking for. (That's a caret and a capital o.)
if ($^O =~ /Win32/i) { do this; } else { do that; }
Head on over to perlvar to read more about this special variable.