programming-examples/perl/SystemFunction/Detecting Whether Your Script Is Running on Windows or UNIX using $^O.pl
2019-11-15 12:59:38 +01:00

13 lines
189 B
Perl

#!/usr/bin/perl -w
if (is_windows() ) {
print "We are running under Windows.\n";
}
print "The OS name is $^O\n";
sub is_windows() {
return $^O =~ /^(MS)?Win/;
}