in reply to Why is my loop dropping alphabetic strings?
I have no idea what that means, but it is a clue for more experienced eval monk.use warnings; use strict; my $NB_ORA_CINC; my $NB_ORA_CLIENT; my @NB_VAR_LIST=("NB_ORA_CINC", "NB_ORA_CLIENT"); my $NB_VAR; $ENV{NB_ORA_CLIENT} = 'client01'; $ENV{NB_ORA_CINC} = 1; foreach $NB_VAR ( @NB_VAR_LIST ) { if ( defined $ENV{$NB_VAR} ) { print "Variable $NB_VAR is $ENV{${NB_VAR}}\n"; eval("\$${NB_VAR} = $ENV{${NB_VAR}}"); warn $@ if $@; } } if ( defined $NB_ORA_CINC ) { print "\$NB_ORA_CINC is $NB_ORA_CINC +\n"; } if ( defined $NB_ORA_CLIENT ) { print "\$NB_ORA_CLIENT is $NB_ORA_CLIE +NT\n"; } __END__ Variable NB_ORA_CINC is 1 Variable NB_ORA_CLIENT is client01 Bareword "client01" not allowed while "strict subs" in use at (eval 2) + line 1. $NB_ORA_CINC is 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Why is my loop dropping alphabetic strings?
by aaron_baugher (Curate) on Jun 23, 2012 at 01:26 UTC | |
by DiabeticJim (Initiate) on Jun 23, 2012 at 01:42 UTC | |
by aaron_baugher (Curate) on Jun 23, 2012 at 02:22 UTC |