in reply to Case insensitive keys in global %ENV

*nix right? If so, then changing %ENV only affects the running program and any children. If that's what you need to do, then that's what you need to do. The only real question is do you need the lowercase (or mixed case) entry to still be around. If not, then something like this works fine:

foreach my $key ( keys %ENV ) { my $val = $ENV{$key}; delete $ENV{$key}; $ENV{ uc $key } = $val; }
if you don't mind the *dupes* (not really) entries, then you can simplify even further:
foreach my $key ( keys %ENV ) { $ENV{ uc $key } = $ENV{$key}; }
So what's really the problem -- I see no need for something extreme.

-derby

Replies are listed 'Best First'.
Re^2: Case insensitive keys in global %ENV
by bdimych (Monk) on Aug 15, 2007 at 13:51 UTC
    Yes, target is linux.

    But there will be _some_ENV_manipulations_, and I am not clear what it will be.

    example

    use my_future_runtime; my $x = get_command_line_param(); # $x may be mixed case my $y = read_some_file(); # $y may be mixed case sub_which_add_new_key($x, 'value_for_cobol'); sub_which_delete_key($y); launch_cobol_prog();

    imho, tie the "most right" way in such situation.