#!/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/; }