in reply to How do I...Conditional hash value

Would this work?
my %required = ( path => ($ENV{'HTTP_HOST'} eq "www.shrum.net") ? "g:/websites/shrum.net/" : "d:/users/http/html/" );

Replies are listed 'Best First'.
Re^2: How do I...Conditional hash value
by Anonymous Monk on Oct 05, 2015 at 21:13 UTC

    Yes that should work... Also see:

    use Data::Dumper; my $i1 =1; my %hash = (k1 => {k2 => ($i1 ? 'this' : 'that') }); print Dumper(\%hash) . "\n"; # this $i1 = 0; %hash = (k1 => {k2 => ($i1 ? 'this' : 'that') }); print Dumper(\%hash) . "\n"; # that
    --Div