in reply to Creating new variables from the value of other variables
i'm not really sure what the difference is between "setVariable" and "catVariable" in your code, but how about using a hashtable?
my %vars; open(CONF," conf.file"); while(<CONF>) { ($variablecmd,$variablename,$newdata) = split(/ /, $_); if ($variablecmd eq "setVariable") { $vars{$variablename} = $newdata; } elsif ($variablecmd eq "catVariable") { #assign data to varaible named $variablename if(exists $vars{$variablename}) { $vars{$variablename} = $newdata; } else { die "assignment to undeclared variable"; } } } close(CONF);
anders pearson // digital samurai personal // http://www.columbia.edu/~anders/ weblog // http://thraxil.dhs.org/
|
|---|