What is "$^O" on Cygwin?

J

James E Keenan

Can anyone running Cygwin tell me what the value for $^O is?

perl -e 'print "$^O\n";'

MSWin32? Cygwin? Something else?

Thanks in advance.

jimk
 
B

Bob Walton

James said:
Can anyone running Cygwin tell me what the value for $^O is?

perl -e 'print "$^O\n";'

MSWin32? Cygwin? Something else? ....
jimk

When I try it, I get:

bob@vektron ~
$ perl -e 'print $^O'
cygwin
bob@vektron ~
$
 
R

Randy Harris

James E Keenan said:
Can anyone running Cygwin tell me what the value for $^O is?

perl -e 'print "$^O\n";'

MSWin32? Cygwin? Something else?

Thanks in advance.

jimk

$ perl -e 'print "$^O\n";'
MSWin32
 
B

Bob Walton

James said:
Interesting that the results are *not* consistent!

jimk

I can get that result also, if I execute ActiveState Perl built
for Windoze under Cygwin:

bob@vektron ~
$ /cygdrive/c/perl/bin/perl.exe -e 'print $^O'
MSWin32
bob@vektron ~
$

I was executing Perl built under Cygwin when I got the "cygwin"
result. HTH.
 
J

Joe Smith

Randy said:
$ perl -e 'print "$^O\n";'
MSWin32

That's the wrong perl. You need to readjust your $PATH.

bash-2.05b$ /usr/bin/perl -le 'print $^O'
cygwin
bash-2.05b$ /cygdrive/c/perl/bin/perl -le 'print $^O'
MSWin32
bash-2.05b$

-Joe
 
S

Sisyphus

James E Keenan said:
Can anyone running Cygwin tell me what the value for $^O is?

perl -e 'print "$^O\n";'

MSWin32? Cygwin? Something else?

You will find that '/mswin/i' will always match $^O on Microsoft Windows and
*never* match $^O on Cygwin - and that '/cygwin/i' will always match $^O on
Cygwin and *never* match $^O on Microsoft Windows. (But that answers a
different question :)

Cheers,
Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top