David Falck writes ..
>Is there a programmatic way to tell if I'm on Windows or UNIX? I know
>that $^0 returns the name of the operating system, but can I count on
>matching /MS/i or /Win/i to determine if it's Windows?> If Windows,
>I'll assign 2 to $newline below, else I'll assign 1.
it completely depends on the build process of that version of Perl .. I
think that Cygwin has a different string than the standard (ActiveState)
build
for ActiveState's Perl build it is guranteed to literally match 'MSWin32' on
all Microsoft Win32 platforms .. these are currently
Windows95
Windows98
WindowsMe
WindowsNT 3.51
WindowsNT 4.0
Windows2000
and will soon include
WindowsXP
hence your code (assuming ActiveState Perl) would be
my $newline = ( $^O eq 'MSWin32' ? 2 : 1 );
but check to see what the Cygwin build produces (using perl -V and looking
at the osname value)
references:
perldoc perlvar | grep -A10 "$OSNAME"
perl -V | grep "osname"
--
jason king
By South Carolina state law, if a man promises to marry an unmarried
woman, the marriage must take place. - http://dumblaws.com/