Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"compiler" directives

Status
Not open for further replies.

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!
 
I think I figured it out:

BEGIN {
if ($^O eq "MSWin32") {
print "Windows!\n";
} else {
print "Linux!\n";
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top