Accessing variable hash elements

"Simon McCaughey" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.petal
Message-ID <00cb01c54cb8$5c54ec50$b7f8a52f@AtticPC>
Ok, I know this must be a stupid question, I probably just need more caffeine but.....

I need to access a variable hash element $user{$group}

if I have a Hash as : 
my %user = ( name => 'Simon', group1 => '1', group3 => '1') ;

and an array like :
my @groups = (qw/group1 group2 group3/ );

and I want to do:

<td tal:repeat="group groups">
    <span tal:content="user group">is the user in the group</span>
</td>

I know this last bit is incorrect, but there must be a simple way of accessing $user{$group}

Thanks

Simon
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.