http://www.perlmonks.org?node_id=1022384


in reply to Writing portable code

Or (perhaps):

4. I could use Inline::C or XS:
void f(void) { #ifdef _WIN32 /* code */ #else /* other code */ #endif }
This avoids any runtime or compile-time determination of the OS. (It was already determined when the script/module was built.) And only the one file !

Cheers,
Rob