in reply to Checking environment smart solution

Don't split one value into 4 variables, only one of which can be true.

Don't include $! in your error message. You didn't do any system calls that set $!.

Why aren't you using die? It'll be much more simpler and reliable to catch exceptions and/or STDERR rather than using errmsg everywhere.

sub inspect { return "windows" if $^O eq 'MSWin32' || $^O eq 'Windows_NT'; my $frunext = $ENV{FRUNEXT} or die("Environment variable 'FRUNEXT' not set\n"); return $frunext if $frunext =~ /^(?:ifx|msv|ora)$/; return ''; }
Or if you want to do some translation:
my %db_lkup = ( ifx => 'informix', msv => 'sql', ifx => 'oracle', ); sub inspect { return "windows" if $^O eq 'MSWin32' || $^O eq 'Windows_NT'; my $frunext = $ENV{FRUNEXT} or die("Environment variable 'FRUNEXT' not set\n"); return $db_lkup{$frunext} if exists( $db_lkup{$frunext} ); return ''; }

I didn't know if you meant for an unrecognized value of $ENV{FRUNEXT} to be an error. It wasn't, so I didn't change that.