in reply to How do I tell what OS I'm running under?

As someone pointed out, the $^O variable may have been set wrong. Another way to do it would be to check for the existence of certain files - it looks like from your example that you already know of two directories that will be there. You could simply test for one or the other's existence, as long as you had a guarantee that it existed on one OS and did not exist on the other. A quick and dirty fix, of course, but AWTDI. You may even want to test for the location of perl.exe - very unlikely to be in the same place on Windows and Linux. :)

  • Comment on Re: How do I tell what OS I'm running under?

Replies are listed 'Best First'.
Re: Re: How do I tell what OS I'm running under?
by OeufMayo (Curate) on Jan 14, 2001 at 20:35 UTC

    To go a bit further what turnstep explained, you may check the value of <kbd>$^X</kbd>, which is the path and name of your perl executable. If it ends in '.exe' it's likely you're running under Windows.

    <kbd>--
    PerlMonger::Paris(http => 'paris.pm.org');</kbd>