how can i get Oses NT 4 and Vista when they have the same minor and id

By looking at the major part of the version.

use constant VER_PLATFORM_WIN32_WINDOWS => 1; # Win9x line use constant VER_PLATFORM_WIN32_NT => 2; # WinNT line use constant VER_NT_WORKSTATION => 1; my %oses = ( '9x 4.0 ???' => '95', '9x 4.10 ???' => '98 or 98 SE', '9x 4.90 ???' => 'Me', 'NT 3.51 ???' => 'NT3.51', 'NT 4.? ???' => 'NT4', 'NT 5.0 WS' => '2000', 'NT 5.1 WS' => 'XP', 'NT 5.2 ???' => 'XP Professional x64 Edition, ' .'Server 2003, ' .'Server 2003 R2 or ' .'Home Server', 'NT 6.0 WS' => 'Vista', 'NT 6.0 !WS' => 'Server 2008', 'NT 6.1 WS' => '7', 'NT 6.1 !WS' => 'Server 2008 R2', ); my ($id, $major, $minor, $prod_type) = ( Win32::GetOSVersion() )[4,1,2,8]; my $id_str = join(' ', $id == VER_PLATFORM_WIN32_NT ? 'NT' : '9x', "$major.$minor", $prod_type == VER_NT_WORKSTATION ? 'WS' : '!WS' ], ); my $os = $oses{$id_str};

(Replace the "???" with the missing information.)

See Getting the System Version. OSVERSIONINFOEX is also interesting.


In reply to Re: split OSVersion in two categories by ikegami
in thread split OSVersion in two categories by nico7nibor

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.