From: Charles Oliver Nutter Date: 2008-07-02T01:20:13+09:00 Subject: Re: Dynamic Variables Igal Koshevoy wrote: > # Python > counter = 52 > eval(compile('box%s = "cat and dogs"' % counter, '', 'exec')) > print box52 # => "cat and dogs" > > # Perl > $counter = 52; > eval("\$box$counter = 'cat and dogs'"); > print $box52, "\n"; # => "cat and dogs" In python, local variables are not (necessarily) determined at parse/compile time. They're slots in a local scope that can grow later on. In Ruby, this behavior only exists for eval scopes. Ruby 1.8 shares a single eval scope under any given normal scope across all evals in that normal scope. Ruby 1.9 instantiates a new eval scope for each eval. I don't know what Perl does. - Charlie