--- Peter Jay Salzman <[EMAIL PROTECTED]> wrote:
> in perl, how does one go about detecting what
> operating system the
> program is running under?
---------------------------
#!/perl/bin/perl -w
use strict;
my $OS = '';
# ----- Thanks to the author of CGI.pl -----
#
# FIGURE OUT THE OS WE'RE RUNNING UNDER
# Some systems support the $^O variable. If not
# available then require() the Config library
unless ($OS) {
unless ($OS = $^O) {
require Config;
$OS = $Config::Config{'osname'};
}
}
if ($OS=~/Win/i) { $OS = 'WINDOWS'; }
elsif ($OS=~/vms/i) { $OS = 'VMS'; }
elsif ($OS=~/^MacOS$/i) { $OS = 'MACINTOSH'; }
elsif ($OS=~/os2/i) { $OS = 'OS2'; }
else { $OS = 'UNIX'; }
print "The OS is: ", $OS;
----------------------------------
Happy Holidays,
Jim
__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com
_______________________________________________
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech