Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: reading env variable in cygwin using perl

by Corion (Patriarch)
on Mar 27, 2006 at 10:55 UTC ( [id://539416]=note: print w/replies, xml ) Need Help??


in reply to reading env variable in cygwin using perl

Most likely, the OSTYPE environment variable is simply not set, and hence you get an undefined value for it. You can check that by using:

my $OSTY; if (not exists $ENV{OSTYPE}) { warn "Couldn't determine OSTYPE"; $OSTY = "<unknown>"; } else { $OSTY = $ENV{OSTYPE} };

More likely though, you might want to inspect the $^O variable, which returns you the type of operating system:

print "Running under $^O";

You could combine the two techniques, and fall back if $ENV{OSTYPE} is unavailable:

my $OSTY; if (not exists $ENV{OSTYPE}) { warn "Couldn't determine OSTYPE from environment - using $^O"; $OSTY = $^O; } else { $OSTY = $ENV{OSTYPE} };

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://539416]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2024-04-19 14:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found