sub Init { use Common::Module; my ($common_var01, $common_var02) = ($foo, $bar); if ($^0 eq "MSWin32") { require Win32::Baz; require Win32::Quux; common_sub01 = "common_sub01_nt"; common_sub02 = "common_sub02_nt"; } else { require Foo; common_sub01 = "common_sub01_unix"; common_sub02 = "common_sub02_unix"; } } sub common_sub01_nt { ... } sub common_sub01_unix { ... } # main program # (where we call the subs) &$common_sub01($foo, $bar) if $foobar;