This may not be completely relevant to your question, but it's related. In most cases, the difference between Windows and Windows is immaterial. Or Linux and Linux. But sometimes it matters.

If you're trying to figure out the difference between Windows ME, Windows 2003, and Windows XP, you have to first use $^O to find out you're on Windows, then load the appropriate Win32 module and find out the version of the OS. Or, if you're trying to figure out the difference between Windows/x86, Windows/x86-64 (AMD64 or EM64T), and Windows/ia64, you need to check %ENV. You're looking for either PROCESSOR_ARCHITEW6432 or PROCESSOR_ARCHITECTURE - which one depends on the machine. I actually use my $proc = $ENV{PROCESSOR_ARCHITEW6432} || $ENV{PROCESSOR_ARCHITECTURE};.

If you're trying to figure out the difference between Linux/x86, Linux/x86-64, Linux/ia64, Linux/ppc, Linux/390, Linux/390x, etc., you need to check the uname - $Config::Config{'archname'} is often good enough.

Again, it usually doesn't matter. It does for me, though, so I've got a routine to explicitly figure out precisely which platform I'm on, and then I load a data file that describes the platform ("unix" vs "win"; "linux" vs "aix" vs "sun" vs "hp" vs "dynix" vs "sco" vs...; "SystemV"; etc.) and then I deal with that data object to find out whether or not to do certain things, and, if I want to do something, how to do it.


In reply to Re: How can my code discover the operating system name? by Tanktalus
in thread How can my code discover the operating system name? by biochris

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.