Re: Alternatives to eval

2011-04-25 Thread Shawn H Corey
On 11-04-25 09:20 PM, siegfr...@heintze.com wrote: Is there a counterpart to the lisp set function in Perl? Not really. Consider using a hash instead. $hash{x} = 23; To view your data structures, use Data::Dumper; use Data::Dumper; print Dumper( \%hash ); Data::Dumper is a standard module

Re: Alternatives to eval

2011-04-25 Thread Jeff Pang
2011/4/26 : > > > $s = "$x = 23"; > eval $s; > > eval a string is considered a bad way. You may store and read the variables to and from a pure Perl data structure storage, like Tie::Hash. Regards. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: begi

Alternatives to eval

2011-04-25 Thread siegfried
Ooops, I forgot to use plain text when I sent this the first time. Sorry if this appears twice. I want read some variable names and values out of a flat (xml) file and assign them. I suppose I could write $s = "$x = 23"; eval $s; Is this the best way? Is there a better way? In lisp, I would