APM: Variable to determine OS

Mike South msouth at fulcrum.org
Thu Jul 18 18:40:17 CDT 2002


Hi,

(The answer ( $^O ) was already posted, I'm just following up in the
"teach a man to fish" category.)  For anything that is a special
variable like this you can do 

	perldoc perlvar

at your command line to get the help page on that.

Also, if you 'use English';, it's $OSNAME, which may be easier
to remember.

	perl -MEnglish -e 'print "$OSNAME\n"'

[Now I'm just rambling on for the benefit of any newbies]

Another nice thing with perldoc is the -f flag to get info
on a particular function.  For example, 

	perldoc -f sort

will tell you most of the details about sort() that you keep
forgetting because you keep getting dragged into doing C programming
instead of having the joy of a nothing-but-perl job.

Heh.  And to think, the answer to this question was really only three
characters long. :)

mike



More information about the Austin mailing list