Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect and Display of operating system using Perl

Tags:

perl

I want to display my computer's operating system using Perl. I thought the following would do

#!/usr/bin/perl
use strict;
use warnings;

my $os = $^O;
print "$os\n";

But the output I got is

linux

I want the output to be displayed as

Windows XP

How to do this? Please help. Thanks in advance.

like image 510
user2201935 Avatar asked Jan 25 '26 22:01

user2201935


1 Answers

Use the uname() function that the POSIX module provides for you.

like image 170
wsdookadr Avatar answered Jan 27 '26 11:01

wsdookadr