On May 17, Alberto Manuel Brandao Simoes said:

>RULE ---> FILE*
>
>::t {
>       for (@FILE) {
>               #do something
>       }
>}
>
>The idea is, when parsing the RULE, create the FILE array so that the user can
>browse it. This is done by an eval, so I can construct a string initializing
>this array, but as said on last mail, I was trying to construct the array
>itself. The solution will pass by a @{$rule->{FILE}} style access?

As said, naming variables with other variables is *very* shifty.

So, use a hash.  The keys are the names you WOULD have used for variables.

  ($variable) = getNextRule();

  $data{$variable} = [ ... ];  # create an anonymous array

Now, instead of looking at @$variable, look at @{ $data{$variable} }.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter.         Brother #734
*** I need a publisher for my book "Learning Perl Regular Expressions" ***

Reply via email to