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
Englishmodule.$OSNAMEis actually an alias for$^O, you can use$^Owithout usingEnglishmodule but to use$OSNAMEyou need to use theEnglishmodule.Also since
use strictis 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: