I remember having used the variable $OSNAME in Linux.
Currently I'm working on a project on Solaris where I need to get the OS name and that variable is not working on Solaris.
Even a simple one line program does not work:
print "OS is $OSNAME\n";
it prints
OS is
Please help.
You need to use the English module.
$OSNAME is actually an alias for $^O, you can use $^O without using English module but to use $OSNAME you need to use the English module.
Also since use strict is missing you did not get any errors.
Always use use strict; in your program, it will help you catch these kinds of errors.
So try:
use English;
use strict;
print "Operating system is $OSNAME\n";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With