Kevin Pfeiffer wrote:

> I thought the easy way to do this is to first assign my entire 'en' data
> structure to the 'de' structure and then add 'de' values as available.
>
> So I did this:
>
> $text{'main'}{'de'} =  $text{'main'}{'en'};
>
>         $text{'main'}{'de'} = {  # German labels
>             'alias_sub'         =>  "ALIAS",
>             'user_sub'          =>  "BENUTZER",
>         };
>
> But this assignment doesn't seem to work. Can I not do this?

I bet it does.  Just not the way you want it to.


$text{'main'}{'de'} =  $text{'main'}{'en'};
Assigns $text{'main'}{'de'} to the anonymous hash pointed to by
$text{'main'}{'en'}

        $text{'main'}{'de'} = {  # German labels
            'alias_sub'         =>  "ALIAS",
            'user_sub'          =>  "BENUTZER",
        };


Assigns $text{'main'}{'de'} to the anonymous hash containing:
 'alias_sub'         =>  "ALIAS",
 'user_sub'          =>  "BENUTZER",
Thus nullifying the effect of the previous statement.

*Hash-based structures do not have columns or support parallelism*

I'd suggest a little restructuring:

$text{'main'} = {
    'alias_sub'  => {'en' => 'Alias', 'de' => 'Allas'},
    'user_sub'  => {'en'  => 'User', 'de' => 'Benutzer'},
...
}

A little less elegant when it comes to accessing it, but if you see the
potential for forgetting the German counterparts as serious, this would make it
much less likely.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to