May 19, 2008 #1 CJason Programmer Joined Oct 13, 2004 Messages 223 Location US Since they say "anything you can write in C you can also do in Perl", how would one implement compiler directives in Perl. For example: #ifdef WINDOWS print "Windows!\n"; #elif defined(LINUX) print "Linux!\n"; #endif Thanks in advance!
Since they say "anything you can write in C you can also do in Perl", how would one implement compiler directives in Perl. For example: #ifdef WINDOWS print "Windows!\n"; #elif defined(LINUX) print "Linux!\n"; #endif Thanks in advance!
May 19, 2008 Thread starter #2 CJason Programmer Joined Oct 13, 2004 Messages 223 Location US I think I figured it out: BEGIN { if ($^O eq "MSWin32") { print "Windows!\n"; } else { print "Linux!\n"; } } Upvote 0 Downvote
I think I figured it out: BEGIN { if ($^O eq "MSWin32") { print "Windows!\n"; } else { print "Linux!\n"; } }